[英]How to use Theme.AppCompat.Light.Dialog on Android 6.0?
I want to display activity which should look like dialog. 我想显示看起来像对话框的活动。 I'm using theme inherited from Theme.AppCompat.Light.Dialog to achievie that .
我正在使用从Theme.AppCompat.Light.Dialog继承的主题来实现这一目标。 This solution works quite well on Android 4.x and Android 5.x.
此解决方案在Android 4.x和Android 5.x上运行良好。 Unfortunately on Android 6 it doesn't.
不幸的是,在Android 6上它没有。 I see black background instead of nice transparency.
我看到黑色背景而不是漂亮的透明度。
Theme code: 主题代码:
<style name="AppTheme.Popup" parent="Theme.AppCompat.Light.Dialog">
<item name="windowNoTitle">true</item>
</style>
Activity code - just extended from AppCompatActivity 活动代码 - 仅从AppCompatActivity扩展而来
I was trying to fix using some another settings: 我试图使用其他设置修复:
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
Without any success :( 没有任何成功:(
I think you need to sub theme Theme.AppCompat.Light.Dialog.Alert
not Theme.AppCompat.Light.Dialog
, so your theme will be like: 我认为你需要子主题
Theme.AppCompat.Light.Dialog.Alert
而不是Theme.AppCompat.Light.Dialog
,所以你的主题将是:
<style name="AppTheme.Popup" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="windowNoTitle">true</item>
</style>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.