从 Android Wear 2.0.0-alpha3 升级到 2.0.0 版本破坏了我的布局
Upgrading from Android Wear 2.0.0-alpha3 to 2.0.0 release breaks my layouts
从 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 上进行测试。
这实际上是 BoxInsetLayout
中的错误修复 - 之前,FrameLayout
上的 android:padding="5dp"
被忽略了(这就是 'Forehand' 直接在边缘的原因app:layout_box="all"
边)。现在,它受到了尊重,你的整个内心世界都被充实了,导致总体上 space 更少。
删除 FrameLayout
中的 android:padding="5dp"
应该足以恢复以前的外观。
从 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 上进行测试。
这实际上是 BoxInsetLayout
中的错误修复 - 之前,FrameLayout
上的 android:padding="5dp"
被忽略了(这就是 'Forehand' 直接在边缘的原因app:layout_box="all"
边)。现在,它受到了尊重,你的整个内心世界都被充实了,导致总体上 space 更少。
删除 FrameLayout
中的 android:padding="5dp"
应该足以恢复以前的外观。