我曾经在Android Wear 4.4W版本上使用半透明的活动背景,方法是不指定主题,并将活动布局中的背景设置为#BB000000。
现在我使用的是Android Wear 5.0.1版本,背景不再半透明,前景元素在背景中随机出现并跳动,导致效果非常混乱。
我尝试使用自定义主题,代码如下:
<style name="Theme.Transparent" parent="android:Theme.DeviceDefault">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
我也尝试使用。
android:theme="@android:style/Theme.Translucent"
都没有运气 - 出现了相同的奇怪不透明效果。
我的活动布局如下:
<android.support.wearable.view.BoxInsetLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#BB000000"
android:layout_height="match_parent"
android:layout_width="match_parent">
<FrameLayout
android:id="@+id/frame_layout"
android:layout_height="match_parent"
android:layout_width="match_parent"
app:layout_box="left|bottom|right">
<android.support.wearable.view.WearableListView
android:id="@+id/wearable_list"
android:layout_height="match_parent"
android:layout_width="match_parent">
</android.support.wearable.view.WearableListView>
</FrameLayout>
</android.support.wearable.view.BoxInsetLayout>
有什么想法吗?