ITeye博客

Android,去除Dialog的边框

andyzhchy · 2011-10-19 14:49 · Android · 移动开发 · Markdown

a.首先为这个半透明弹窗新建一个名为dialog.xml的Layout b.res/values文件夹新建名为 dialogStyle.xml的resources样式文件,具体代码如下:

 
    <?xml version="1.0" encoding="utf-8"?>
        <resources>
            <style name="dialog" parent="@android:style/Theme.Dialog">
                <item name="android:windowFrame">@null</item>
                <item name="android:windowIsFloating">true</item>
                <item name="android:windowIsTranslucent">false</item>
                <item name="android:windowNoTitle">true</item>
                <item name="android:windowBackground">@drawable/dia_bg</item>
                <item name="android:backgroundDimEnabled">false</item>
            </style>
        </resources>

c.

 
        View diaView=View.inflate(this, R.layout.dialog, null);
        dialog=new Dialog(AuthorizeActivity.this,R.style.dialog);//这里应用了你的自定义样式
        dialog.setContentView(diaView);
        dialog.show();

注:本文取自于网络

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。