样式一:
1 styles.xml 2 3 <style name="Dialog" parent="android:style/Theme.Dialog"> 4 <item name="android:windowNoTitle">true</item> 5 <item name="android:windowFrame">@null</item> <!--边框--> 6 <item name="android:windowIsFloating">true</item> <!--是否浮现在activity之上--> 7 <item name="android:windowIsTranslucent">true</item><!--半透明--> 8 <item name="android:background">@android:color/transparent</item><!--背景透明--> 9 <item name="android:windowBackground">@android:color/transparent</item><!--背景透明--> 10 <item name="android:backgroundDimEnabled">true</item> <!--蒙版- 模糊 --> 11 </style>
styles.xml
样式二:
1 <style name="RecordAudioDialogSytle"> 2 <item name="android:windowContentOverlay">@null</item> 3 <item name="android:windowAnimationStyle">@null</item> 4 <item name="android:windowNoTitle">true</item> 5 <item name="android:windowNoDisplay">true</item> 6 <item name="android:windowIsFloating">true</item> 7 <item name="android:windowFrame">@null</item> 8 <item name="android:windowIsTranslucent">false</item> 9 <item name="android:windowBackground">@drawable/filled_box</item> 10 <item name="android:backgroundDimEnabled">false</item> 11 </style>
styles.xml
圆角设置:
1 filled_box.xml 2 3 <shape xmlns:android="http://schemas.android.com/apk/res/android"> 4 <solid android:color="#ffffffff"/> 5 <stroke android:width="1dip" color="@android:color/transparent"/> 6 <corners android:radius="7dip" /> 7 <padding android:left="0dip" android:top="0dip" 8 android:right="0dip" android:bottom="0dip" /> 9 </shape>
filled_box.xml
显示:
Dialog dialog = new Dialog(this,R.style.RecordAudioDialogSytle); dialog.setCancelable(false); dialog.setContentView(R.layout.main); dialog.show();
android4.0设置状态栏:
private void setStatusBarState(boolean statusBarState){ StatusBarManager sbm = (StatusBarManager) mActivity.getSystemService("statusbar"); if(statusBarState){ sbm.disable(sbm.DISABLE_NONE); }else{ sbm.disable(sbm.DISABLE_MASK); } } 加入权限 <uses-permission android:name="android.permission.STATUS_BAR"/> <uses-permission android:name="android.permission.DISABLE_STATUS_BAR"/>
Dialog样式
时间: 2024-10-20 08:07:09