Android的全息对话框中有2背景分层彼此顶部 [英] Android Holo Dialog has 2 backgrounds layered on top of one another

查看:113
本文介绍了Android的全息对话框中有2背景分层彼此顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该对话框看起来是这样的。有对话框本身约10-20个像素左右每一侧后面的层。我使用的主题是Theme.Holo.Dialog

The dialog looks like this. There is a layer behind the dialog itself about 10-20 pixels or so on each side. The theme I am using is Theme.Holo.Dialog

我试图创建一个透明背景的自定义对话框,但没有奏效:

I tried creating a custom dialog with a transparent background, but that did not work:

<style name="CustomHoloDialog" parent="@android:style/Theme.Holo.Dialog">
     <item name="android:background">@android:color/transparent</item>
</style>

没有人有任何想法吗?

Does anyone have any ideas on this?

推荐答案

如果你想样式对话框,那么你必须使用一个 ContextThemeWrapper

If you want to style a Dialog then you have to use a ContextThemeWrapper:

AlertDialog.Builder mBuilder = new AlertDialog.Builder(new ContextThemeWrapper(context, android.R.style.Theme_Holo_Dialog));

这篇关于Android的全息对话框中有2背景分层彼此顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆