[英]style.xml android:windowIsTranslucent dialogs not showing
I have created a transparent AppCompatActivity
that is a type of 'launcher' activity for other activities. 我创建了一个透明的
AppCompatActivity
,它是其他活动的“启动器”活动。 This launcher activity uses a transparent style as found with other stackoverflow questions. 该启动器活动使用其他堆栈溢出问题中发现的透明样式。
<style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.Light.NoActionBar">
<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>
</style>
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/primary</item>
</style>
Sometimes this launcher activity needs to show a progress dialog. 有时,此启动器活动需要显示进度对话框。 However, the progress dialog does not show up when I use the tag
android:windowIsTranslucent
. 但是,当我使用标签
android:windowIsTranslucent
时,进度对话框不会显示。 Commenting out this tag allows the progress dialog to appear, but the activity is no longer transparent. 注释掉该标签后,将显示进度对话框,但活动不再透明。
Is there some sort of alternative solution for this? 是否有某种替代解决方案?
I didn't tried this solution, But i think this could work. 我没有尝试过这种解决方案,但是我认为这可以工作。 Just add
<item name="android:windowIsTranslucent">false</item>
in your AppCompatAlertDialogStyle
只需在您的
AppCompatAlertDialogStyle
添加<item name="android:windowIsTranslucent">false</item>
Solution would be like 解决方案就像
<style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.Light.NoActionBar">
<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>
</style>
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/primary</item>
<item name="android:windowIsTranslucent">false</item>
</style>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.