【问题标题】:Upgrading from Android Wear 2.0.0-alpha3 to 2.0.0 release breaks my layouts从 Android Wear 2.0.0-alpha3 升级到 2.0.0 版本破坏了我的布局
【发布时间】:2017-02-12 19:46:05
【问题描述】:

从 2.0.0-alpha3 升级到 2.0.0 后,我的大部分观点看起来都出现了偏差。这是我正在使用的布局的 XML:

<?xml version="1.0" encoding="utf-8"?>
<android.support.wearable.view.BoxInsetLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="oviroa.bestshot.android.StartPlayActivity"
    tools:deviceIds="wear"
    android:padding="15dp">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="5dp"
        app:layout_box="all">
        <TextView
            android:id="@+id/shot_type"
            app:layout_box="all"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/forehand"
            android:theme="@style/BST.HeaderText"/>
        <Button
            android:layout_marginTop="30dp"
            android:layout_marginBottom="0dp"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="15dp"
            android:id="@+id/record"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/swoosh_background"
            android:text="@string/record_action"
            android:gravity="center_horizontal|bottom"
            android:textAlignment="center"
            android:paddingBottom="15dp"
            android:theme="@style/BST.ButtonWithIcon.Bold" />
    </FrameLayout>
</android.support.wearable.view.BoxInsetLayout>

您可以在下面的屏幕截图中看到,该按钮相当倾斜。我没有通过代码进行任何操作。

这是 2.0.0-alpha3:

这是 2.0.0 的最终版本:

我正在测试 LG Urbane 第二代 LTE。

【问题讨论】:

    标签: wear-os android-wear-2.0


    【解决方案1】:

    这实际上是 BoxInsetLayout 中的一个错误修复 - 之前,FrameLayout 上的 android:padding="5dp" 被忽略(这就是为什么“正手”直接位于 app:layout_box="all" 边缘的边缘)。现在,它受到尊重,您的整个内部视图都被填充到各个方面,从而减少了整体空间。

    删除FrameLayout 中的android:padding="5dp" 应该足以恢复以前的外观。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多