Dialog样式

样式一:




styles.xml
<style name="Dialog" parent="android:style/Theme.Dialog"> 
<item name="android:windowNoTitle">true</item>
<item name="android:windowFrame">@null</item> <!--边框-->
<item name="android:windowIsFloating">true</item> <!--是否浮现在activity之上-->
<item name="android:windowIsTranslucent">true</item><!--半透明-->  
<item name="android:background">@android:color/transparent</item><!--背景透明-->
<item name="android:windowBackground">@android:color/transparent</item><!--背景透明-->
<item name="android:backgroundDimEnabled">true</item> <!--蒙版- 模糊 -->
</style>
 

样式二:styles.xml








    <style name="RecordAudioDialogSytle">
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowAnimationStyle">@null</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowNoDisplay">true</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:windowFrame">@null</item>
        <item name="android:windowIsTranslucent">false</item>
        <item name="android:windowBackground">@drawable/filled_box</item> 
        <item name="android:backgroundDimEnabled">false</item>
    </style>






圆角设置:







filled_box.xml




<shape xmlns:android="http://schemas.android.com/apk/res/android">  
    <solid android:color="#ffffffff"/>  
    <stroke android:width="1dip" color="@android:color/transparent"/>  
    <corners android:radius="7dip" />  
    <padding android:left="0dip" android:top="0dip"  
        android:right="0dip" android:bottom="0dip" />  
</shape> 

显示:





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"/>

相关推荐