美文网首页
Dialog弹出后取消背景变暗的效果

Dialog弹出后取消背景变暗的效果

作者: 留给时光吧 | 来源:发表于2017-03-08 14:19 被阅读0次

默认的Android弹出一个Dialog窗口后,背景会变暗。修改设置模块中的亮度设置时,由于弹出的窗口比较小,调节亮度时,预览不明显,所以需要取消背景变暗的效果。

首先在style.xml中添加:

<style name="NobackDialog" parent="@android:style/Theme.Dialog">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowIsTranslucent">false</item>
        <item name="android:backgroundDimEnabled">false</item>
    </style>

之后在创建Dialog时应用即可

AlertDialog.Builder builder = new AlertDialog.Builder(mContext,R.style.NobackDialog);

相关文章

网友评论

      本文标题:Dialog弹出后取消背景变暗的效果

      本文链接:https://www.haomeiwen.com/subject/pbybgttx.html