DialogFrame 有黑色边框,怎么去除

打不打伞心都是湿的-_- 2016-08-15 09:50:44
加急,,在线等......,首个APP项目,求大神指点
如图
/

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 }

...全文
716 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
lifs419 2019-11-07
  • 打赏
  • 举报
回复
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
Anataaa 2016-11-14
  • 打赏
  • 举报
回复
好吧 自定义继承Dialog解决了
Anataaa 2016-11-02
  • 打赏
  • 举报
回复
解决了吗?求经验
qeqeqwesc2006 2016-08-16
  • 打赏
  • 举报
回复
引用 14 楼 qq_28224387 的回复:
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 ); 还是不行啊,,,
你的onCreateDialog里面builder第二个参数传style看看 看这个样子是你dialogfragment里面的dialog背景有问题啊。
  • 打赏
  • 举报
回复

 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 );                                                                               

  • 打赏
  • 举报
回复
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 ); 还是不行啊,,,
qeqeqwesc2006 2016-08-15
  • 打赏
  • 举报
回复
引用 8 楼 qq_28224387 的回复:
[quote=引用 7 楼 qeqeqwesc2006 的回复:] 哥们 搞定了 记得结贴哦
<item name="android:windowBackground">@drawable/transparent</item><!--背景透明--> 哥们,drawable/transparent这个怎么画,,???[/quote] 添加一个drawable啊 值设置成#00000000
qeqeqwesc2006 2016-08-15
  • 打赏
  • 举报
回复
引用 10 楼 qeqeqwesc2006 的回复:
[quote=引用 9 楼 qq_28224387 的回复:] [quote=引用 楼主 qq_28224387 的回复:] 加急,,在线等......,首个APP项目,求大神指点 如图 /

 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         }  

还是不行了。我说的是红色外面那个边框[/quote] AlertDialog不是有这个构造函数么 ,你第二个参数就传自定义的theme protected AlertDialog(Context context, int theme) { this(context, theme, true); }[/quote] 或者这样 public Builder(Context context, int theme) { P = new AlertController.AlertParams(new ContextThemeWrapper( context, resolveDialogTheme(context, theme))); mTheme = theme; }
qeqeqwesc2006 2016-08-15
  • 打赏
  • 举报
回复
引用 9 楼 qq_28224387 的回复:
[quote=引用 楼主 qq_28224387 的回复:] 加急,,在线等......,首个APP项目,求大神指点 如图 /

 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         }  

还是不行了。我说的是红色外面那个边框[/quote] AlertDialog不是有这个构造函数么 ,你第二个参数就传自定义的theme protected AlertDialog(Context context, int theme) { this(context, theme, true); }
  • 打赏
  • 举报
回复
引用 楼主 qq_28224387 的回复:
加急,,在线等......,首个APP项目,求大神指点 如图 /

 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         }  

还是不行了。我说的是红色外面那个边框
  • 打赏
  • 举报
回复
引用 7 楼 qeqeqwesc2006 的回复:
哥们 搞定了 记得结贴哦
<item name="android:windowBackground">@drawable/transparent</item><!--背景透明--> 哥们,drawable/transparent这个怎么画,,???
qeqeqwesc2006 2016-08-15
  • 打赏
  • 举报
回复
哥们 搞定了 记得结贴哦
qeqeqwesc2006 2016-08-15
  • 打赏
  • 举报
回复
你自定义的dialog的style
  • 打赏
  • 举报
回复
引用 4 楼 qeqeqwesc2006 的回复:
<style name="CumstomDialog" parent="@android:style/Theme.Dialog"> <item name="android:windowFrame">@null</item><!--边框--> <item name="android:windowIsFloating">true</item><!--是否浮现在activity之上--> <item name="android:windowIsTranslucent">false</item><!--半透明--> <item name="android:windowNoTitle">true</item><!--无标题--> <item name="android:windowBackground">@drawable/transparent</item><!--背景透明--> <item name="android:backgroundDimEnabled">false</item><!--模糊--> <item name="android:windowContentOverlay">@null</item> </style> 设置这个属性就可以 <item name="android:windowBackground">@drawable/transparent</item><!--背景透明--> 注意你如果要new这个dialog出来,用dialog两个参数的构造函数,第二个参数传你用的style
是设置 Dialog的Style还是 DialogFragment的style?
qeqeqwesc2006 2016-08-15
  • 打赏
  • 举报
回复
<style name="CumstomDialog" parent="@android:style/Theme.Dialog"> <item name="android:windowFrame">@null</item><!--边框--> <item name="android:windowIsFloating">true</item><!--是否浮现在activity之上--> <item name="android:windowIsTranslucent">false</item><!--半透明--> <item name="android:windowNoTitle">true</item><!--无标题--> <item name="android:windowBackground">@drawable/transparent</item><!--背景透明--> <item name="android:backgroundDimEnabled">false</item><!--模糊--> <item name="android:windowContentOverlay">@null</item> </style> 设置这个属性就可以 <item name="android:windowBackground">@drawable/transparent</item><!--背景透明--> 注意你如果要new这个dialog出来,用dialog两个参数的构造函数,第二个参数传你用的style
哎,真难 2016-08-15
  • 打赏
  • 举报
回复
你的theme有没有定义
  • 打赏
  • 举报
回复
引用 1 楼 heaimnmn 的回复:
自定义布局文件
是自定义的,也不知道那个边框是怎么出来的。 这个是DialogFragement的布局文件。

  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>

哎,真难 2016-08-15
  • 打赏
  • 举报
回复
自定义布局文件
xjz729827161 2016-08-15
  • 打赏
  • 举报
回复
尝试下,view填充布局后加上如下: view.setLayoutParams(new FrameLayout.LayoutParams(-1,-1));

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧