AlertDialog.Builder创建的Dialog有黑边

正常使用:AlertDialog.Builder dialog = new AlertDialog.Builder(this);

              dialog.setView(view);

              dialog.show();  

这样弹出的dialog会有黑边,就像这样:

此时我们只需要在styles里自定义一个style,然后在AndroidManifest.xml里把该dialog所在的Activity的Theme添加或者替换成这个style即可。

<style name="NoDarkEdgeTheme.Light" parent="android:Theme.Holo.Light.DarkActionBar">
        <item name="android:windowNoTitle">true</item>
</style>

<activity
            android:name=".NewMainActivity"

            android:theme="@style/NoDarkEdgeTheme.Light"/>

这样添加之后,再看效果:



是不是瞬间感觉这个弹窗漂亮了许多!






猜你喜欢

转载自blog.csdn.net/S_Alics/article/details/80361185
今日推荐