我正在尝试在主屏幕和锁定屏幕上显示透明活动。解锁后(在主屏幕中)它正确显示为透明,但在锁定屏幕上有黑色背景。我怎样才能摆脱这种黑色背景? 谢谢
样式定义:
<style name="MyactivityTheme" parent="Theme.AppCompat.Light.NoactionBar" tools:ignore="NewApi">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
清单定义:
<application>
<activity
android:name=".Myactivity"
android:windowSoftInputMode="stateVisible"
android:theme="@style/MyactivityTheme"
android:showOnLockScreen="true"/>
</application>
活动布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:backgroundTint="@android:color/transparent"
tools:context=".Myactivity">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/holo_green_dark"
android:text="My activity"
android:layout_centerInParent="true"/>
</RelativeLayout>