[英]Not able to set transparent background for Popup Window Activity
I am following this particular example to create a popup window activity but when I click on a button to open this activity, the background is not semi-transparent as mentioned in the example.我正在按照这个特定的示例创建一个弹出式 window 活动,但是当我单击按钮打开此活动时,背景不是示例中提到的半透明。 I am new to android kotlin development so I am not able to figure this out on my own.我是 android kotlin 开发的新手,所以我无法自己解决这个问题。 Let me know what I am doing wrong.让我知道我做错了什么。
EDIT: This link tells a different method but working fine.编辑:此链接讲述了一种不同的方法,但工作正常。
You can customize the translucent theme of your activity, in your "AndroidManifest.xml" file.您可以在“AndroidManifest.xml”文件中自定义活动的半透明主题。
<activity
android:name=".ui.PopUpWindow"
android:theme="@style/AppTheme_translucent" />
and in your "styles.xml" file.并在您的“styles.xml”文件中。
<style name="AppTheme_translucent" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowIsTranslucent">true</item>
</style>
I travel the code and did not see setContentView()
method for PopupWindow
activity.我浏览了代码,但没有看到PopupWindow
活动的setContentView()
方法。 Please set content view for the activity by calling the method inside PopupWindow's onCreate()
请通过调用 PopupWindow 的onCreate()
中的方法为活动设置内容视图
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.