1,Settings/AndroidManifest.xml 在设置中注册一个广播
+ <receiver android:name="com.android.settings.ColorTemperatureBrocastReceiver">
10 + <intent-filter >
11 + <action android:name="android.intent.action.BOOT_COMPLETED"></action>
12 + </intent-filter>
13 + </receiver>
2. Settings/res/layout/dialog_fragment.xml 写一个dialogFragment
+<?xml version="1.0" encoding="utf-8"?>^M
23 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"^M
24 + android:orientation="vertical"^M
25 + android:layout_width="match_parent"^M
26 + android:layout_height="match_parent">^M
27 +^M
28 + <LinearLayout^M
29 + android:layout_width="match_parent"^M
30 + android:layout_height="60dp"^M
31 + android:gravity="center"^M
32 + >^M
33 + <TextView^M
34 + android:id="@+id/name"^M
35 + android:layout_width="wrap_content"^M
36 + android:layout_height="wrap_content"^M
37 + android:textColor="#000000"^M
38 + android:text="@string/color_temperature_fragment" />^M
39 + </LinearLayout>^M
40 +^M
41 + <LinearLayout^M
42 + android:layout_width="match_parent"^M
43 + android:layout_height="wrap_content"^M
44 + android:gravity="center">^M
45 + <ImageView^M
46 + android:layout_width="match_parent"^M
47 + android:layout_height="200dp"^M
48 + android:layout_marginLeft="30dp"^M
49 + android:layout_marginRight="30dp"^M
50 + android:src="@drawable/caption_background"/>^M
51 + </LinearLayout>^M
53 + <LinearLayout^M
54 + android:layout_width="match_parent"^M
55 + android:layout_height="wrap_content"^M
56 + android:orientation="vertical"^M
57 + >^M<LinearLayout^M
60 + android:layout_width="match_parent"^M
61 + android:layout_height="wrap_content">^M
62 +^M
63 + <CheckBox android:id="@+id/checkBox"^M
64 + android:layout_marginLeft="15dp"^M
65 + android:layout_width="wrap_content"^M
66 + android:layout_height="wrap_content" />^M
67 +^M
68 + <TextView^M
69 + android:layout_width="wrap_content"^M
70 + android:layout_height="wrap_content"^M
71 + android:text="@string/color_temperature_default"^M
72 + android:textColor="#000000" />^M
73 + </LinearLayout>^M
74 +^M
75 + <SeekBar android:id="@+id/seekbar"^M
76 + android:layout_width="match_parent"^M
77 + android:layout_height="wrap_content"^M
78 + android:layout_marginLeft="15dp"^M
79 + android:layout_marginRight="15dp"^M
80 + android:paddingTop="15dp"^M
81 + android:max="14"/>^M
82 +^M
83 + <LinearLayout^M
84 + android:layout_width="match_parent"^M
85 + android:layout_height="wrap_content"^M
86 + android:paddingTop="10dp">^M
87 +^M
88 + <TextView^M
89 + android:layout_width="wrap_content"^M
90 + android:layout_height="wrap_content"^M
91 + android:layout_marginLeft="30dp"^M
92 + android:layout_weight="1"^M
93 + android:text="@string/warm_color" />^M
<TextView^M
96 + android:layout_width="wrap_content"^M
97 + android:layout_height="wrap_content"^M
98 + android:layout_gravity="right"^M
99 + android:layout_marginRight="30dp"^M
100 + android:text="@string/cool_color" />^M
101 + </LinearLayout>^M
102 +^M
103 + <LinearLayout^M
104 + android:layout_width="match_parent"^M
105 + android:layout_height="wrap_content"^M
106 + android:layout_marginTop="40dp"^M
107 + android:layout_marginBottom="20dp"^M
108 + android:gravity="center">^M
109 +^M
110 + <Button^M
111 + android:id="@+id/cancel"^M
112 + android:layout_width="120dp"^M
113 + android:layout_height="40dp"^M
114 + android:text="@string/color_temperature_cancle" />^M
115 + <Button android:id="@+id/ok"^M
116 + android:text="@string/color_temperature_ok"^M
117 + android:layout_width="120dp"^M
118 + android:layout_height="40dp" />^M
119 + </Linear