oviroa
oviroa

Reputation: 1099

Upgrading from Android Wear 2.0.0-alpha3 to 2.0.0 release breaks my layouts

After upgrading from 2.0.0-alpha3 to 2.0.0, most of my views looked skewed. This is the XML of the layout I am using:

<?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>

The button is considerably skewed as you can see in the screenshots below. Iam not doing any manipulations via code.

This is with 2.0.0-alpha3:

enter image description here

And this is with 2.0.0, the final release: enter image description here

I am testing on LG Urbane 2nd gen LTE.

Upvotes: 0

Views: 99

Answers (1)

ianhanniballake
ianhanniballake

Reputation: 199805

This was actually a bug fix in BoxInsetLayout - before, the android:padding="5dp" on your FrameLayout was being ignored (that's why the 'Forehand' was directly on the edge of the app:layout_box="all" edge). Now, it is being respected and your entire inner view is being padded in on all sides, leading to less space overall.

Removing the android:padding="5dp" in your FrameLayout should be enough to restore the previous look.

Upvotes: 1

Related Questions