Android Wear Lollipop中的半透明/透明活动

3

我曾经在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>

有什么想法吗?

你把主题设置在哪里了? - Lukas
@Lukas AndroidManifest中的Activity定义(不是Application) - barkside
您是否以这种方式提供多个api级别的值文件夹:values-v21? - throws_exceptions_at_you
@throws_exceptions_at_you 我不会抛出异常。 - barkside
这个问题有解决方案吗? - Warlax
@Warlax 我不知道有没有。不过我还没有在Android Wear 5.0.2上尝试过,也不知道是否修复了什么问题... - barkside
1个回答

0

刚在Android Wear 5.1.1上进行了测试

    android:theme="@android:style/Theme.Translucent"

现在提供半透明背景。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接