80,351
社区成员
发帖
与我相关
我的任务
分享
20 public class StatusDialog extends DialogFragment{
19 /**
18 * @brief
17 *
16 * @param Bundle savedInstanceState
15 *
14 * @return
13 */
12 @Override
11 public Dialog onCreateDialog(Bundle savedInstanceState) {
10 AlertDialog.Builder builder = new AlertDialog.Builder( BodyFragment.this.getActivity() );
9 LayoutInflater inflater = BodyFragment.this.getActivity().getLayoutInflater();
8 View view = inflater.inflate( R.layout.status_dialog, null );
7 builder.setView( view );
6
5 Button close_button = (Button) view.findViewById( R.id.status_dialog_close_button );
4 close_button.setOnClickListener( new View.OnClickListener(){
3 public void onClick(View v){
2 StatusDialog.this.getDialog().cancel();
1 }
0 });
1
2 Button busy_button = (Button) view.findViewById( R.id.status_dialog_busy_button );
3 busy_button.setOnClickListener( new View.OnClickListener(){
4 public void onClick(View v){
5 //
6 }
7 });
8
9 Button free_button = (Button) view.findViewById( R.id.status_dialog_free_button );
10 free_button.setOnClickListener( new View.OnClickListener(){
11 public void onClick(View v){
12 //
13 }
14 });
15
16 Button bad_button = ( Button) view.findViewById( R.id.status_dialog_bad_button );
17 bad_button.setOnClickListener( new View.OnClickListener(){
18 public void onClick(View v){
19 //
20 }
21 });
22 return builder.create();
23 }
24 /**
25 * @brief
26 *
27 * @return
28 */
29 public void onResume(){
30 super.onResume();
31 getDialog().getWindow().setBackgroundDrawable( new ColorDrawable( Color.WHITE ) );
32 //getDialog().setTitle(( R.drawable.table_status_free );
33 getDialog().getWindow().setLayout( 200, 100 );
34 }
35 }
15 /home/jiale/workspace/DiningTable/ | 0 <style name="status_dialog" parent="android:style/Theme.Dialog">
14 ▸ bin/ | 1 <item name="android:windowNoTitle">true</item>
13 ▸ doc/ | 2 <item name="android:background">#00000000</item>
12 ▸ gen/ | 3 <item name="android:windowBackground">@android:color/transparent</item>
11 ▸ libs/ | 4 <item name="android:colorBackgroundCacheHint">@null</item>
10 ▾ res/ | 5 <item name="android:windowIsTranslucent">true</item>
9 ▸ drawable-hdpi/ | 6 <item name="android:windowIsFloating">true</item>
8 ▸ drawable-ldpi/ | 7 <item name="android:backgroundDimEnabled">false</item>
7 ▸ drawable-mdpi/ | 8 <item name="android:windowFrame">@null</item>
6 ▸ drawable-xhdpi/ | 9 </style>
5 ▸ drawable/ | 10 </resources>
4 ▸ layout/ |~
3 ▾ values/ |~
2 colors.xml |~
1 strings.xml |~
0 styles.xml |~
1 ▾ src/ |~
2 ▾ dining/ |~
3 ▸ table/ |~
4 AndroidManifest.xml |~
5 ant.properties | NORMAL ▶ styles.xml ▶ ◀ unix ❮ utf-8 ❮ xml ❮ 23% ◀ ⁋ 3:5
6 build.xml | 15 ¦ ¦ ¦ ¦ StatusDialog d = new StatusDialog();
7 local.properties | 14 ¦ ¦ ¦ ¦ d.show( BodyFragment.this.getActivity().getFragmentManager(), "StatusDialog" );
8 proguard-project.txt | 13 ¦ ¦ ¦ }
9 project.properties | 12
~ | 11 ¦ ¦ });
~ | 10 ¦ ¦ //button.setFitsSystemWindows(
~ | 9
~ | 8 ¦ ¦ switch( table.getStatus() ){
~ | 7 ¦ ¦ ¦ case Table.TABLE_STATUS_FREE : button.setBackgroundResource( R.drawable.table_status_free ); break;
~ | 6 ¦ ¦ ¦ case Table.TABLE_STATUS_BUSY : button.setBackgroundResource( R.drawable.table_status_busy ); break;
~ | 5 ¦ ¦ ¦ case Table.TABLE_STATUS_STOP : button.setBackgroundResource( R.drawable.table_status_stop ); break;
~ | 4 ¦ ¦ ¦ default:;
~ | 3 ¦ ¦ }
~ | 2 ¦ ¦ return button;
~ | 1 ¦ }
~ | 0
~ | 1 ¦ /**
~ | 2 ¦ * @brief
~ | 3 ¦ */
~ | 4 ¦ public class StatusDialog extends DialogFragment{
~ | 5 ¦ ¦ public void onCreate( Bundle savedInstanceState ) {
~ | 6 ¦ ¦ ¦ super.onCreate(savedInstanceState);
~ | 7 ¦ ¦ ¦ this.setStyle( R.style.status_dialog, 0 );
再帮忙看看了,那个个黑色的是什么东西?
15 /home/jiale/workspace/DiningTable/ | 0 <style name="status_dialog" parent="android:style/Theme.Dialog">
14 ▸ bin/ | 1 <item name="android:windowNoTitle">true</item>
13 ▸ doc/ | 2 <item name="android:background">#00000000</item>
12 ▸ gen/ | 3 <item name="android:windowBackground">@android:color/transparent</item>
11 ▸ libs/ | 4 <item name="android:colorBackgroundCacheHint">@null</item>
10 ▾ res/ | 5 <item name="android:windowIsTranslucent">true</item>
9 ▸ drawable-hdpi/ | 6 <item name="android:windowIsFloating">true</item>
8 ▸ drawable-ldpi/ | 7 <item name="android:backgroundDimEnabled">false</item>
7 ▸ drawable-mdpi/ | 8 <item name="android:windowFrame">@null</item>
6 ▸ drawable-xhdpi/ | 9 </style>
5 ▸ drawable/ | 10 </resources>
4 ▸ layout/ |~
3 ▾ values/ |~
2 colors.xml |~
1 strings.xml |~
0 styles.xml |~
1 ▾ src/ |~
2 ▾ dining/ |~
3 ▸ table/ |~
4 AndroidManifest.xml |~
5 ant.properties | NORMAL ▶ styles.xml ▶ ◀ unix ❮ utf-8 ❮ xml ❮ 23% ◀ ⁋ 3:5
6 build.xml | 15 ¦ ¦ ¦ ¦ StatusDialog d = new StatusDialog();
7 local.properties | 14 ¦ ¦ ¦ ¦ d.show( BodyFragment.this.getActivity().getFragmentManager(), "StatusDialog" );
8 proguard-project.txt | 13 ¦ ¦ ¦ }
9 project.properties | 12
~ | 11 ¦ ¦ });
~ | 10 ¦ ¦ //button.setFitsSystemWindows(
~ | 9
~ | 8 ¦ ¦ switch( table.getStatus() ){
~ | 7 ¦ ¦ ¦ case Table.TABLE_STATUS_FREE : button.setBackgroundResource( R.drawable.table_status_free ); break;
~ | 6 ¦ ¦ ¦ case Table.TABLE_STATUS_BUSY : button.setBackgroundResource( R.drawable.table_status_busy ); break;
~ | 5 ¦ ¦ ¦ case Table.TABLE_STATUS_STOP : button.setBackgroundResource( R.drawable.table_status_stop ); break;
~ | 4 ¦ ¦ ¦ default:;
~ | 3 ¦ ¦ }
~ | 2 ¦ ¦ return button;
~ | 1 ¦ }
~ | 0
~ | 1 ¦ /**
~ | 2 ¦ * @brief
~ | 3 ¦ */
~ | 4 ¦ public class StatusDialog extends DialogFragment{
~ | 5 ¦ ¦ public void onCreate( Bundle savedInstanceState ) {
~ | 6 ¦ ¦ ¦ super.onCreate(savedInstanceState);
~ | 7 ¦ ¦ ¦ this.setStyle( R.style.status_dialog, 0 );
0 <?xml version="1.0" encoding="utf-8"?>
1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 android:orientation="vertical"
3 android:layout_width="fill_parent"
4 android:layout_height="fill_parent"
5 android:layout_gravity="center_vertical|center_horizontal"
6 android:background="@color/red" //最外层的linearlayout红色。但外面还有一个黑色。是怎么回事
7 >
8 <LinearLayout
9 android:orientation="horizontal"
10 android:layout_width="fill_parent"
11 android:layout_height="20dp"
12 android:layout_gravity="right"
13 >
14 <Button android:id="@+id/status_dialog_close_button"
15 android:layout_height="wrap_content"
16 android:layout_width="wrap_content"
17 android:background="@drawable/status_dialog_close_button"
18 />
19 </LinearLayout>
20
21 <LinearLayout
22 android:orientation="horizontal"
23 android:layout_width="fill_parent"
24 android:layout_height="wrap_content"
25 android:layout_weight="1.0"
26 android:layout_gravity="center_vertical|center_horizontal"
27 >
28 <Button android:id="@+id/status_dialog_busy_button"
29 android:layout_height="wrap_content"
30 android:layout_width="wrap_content"
31 android:text="@string/table_status_busy"
32 android:background="@drawable/table_status_busy"
33 />
34 <Button android:id="@+id/status_dialog_free_button"
35 android:layout_height="wrap_content"
36 android:layout_width="wrap_content"
37 android:text="@string/table_status_free"
38 android:background="@drawable/table_status_free"
39 />
40 <Button android:id="@+id/status_dialog_bad_button"
41 android:layout_height="wrap_content"
42 android:layout_width="wrap_content"
43 android:text="@string/table_status_stop"
44 android:background="@drawable/table_status_stop"
45 />
46 </LinearLayout>
47
48 <LinearLayout
49 android:orientation="horizontal"
50 android:layout_width="fill_parent"
51 android:layout_height="20dp"
52 >
53 </LinearLayout>
54
55 </LinearLayout>