从Android Wear 2.0.0-alpha3升级到2.0.0版本会破坏我的布局

时间:2017-02-12 19:46:05

标签: wear-os android-wear-2.0

从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:

enter image description here

这是2.0.0,最终版本: enter image description here

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

1 个答案:

答案 0 :(得分:1)

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

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