I removed android:padding="15dp " from BoxInsetLayout as Wayne Piekarski . Now BoxInsetLayout is working correctly, but I have a new problem: android:padding="5dp" in FrameLayout does not work. I experimented with activity_layout, and I added id and changed the add- on to 20dp , and I got this result for the Round and Square screen:


My xml code for this
<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout android:id="@+id/first_frame_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/red" android:padding="20dp" app:layout_box="all"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Hello Android Wear" android:textColor="@color/black" /> <ImageButton android:layout_width="50dp" android:layout_height="50dp" android:layout_gravity="bottom|start" android:background="@drawable/selector_btn_ok" /> <ImageButton android:layout_width="50dp" android:layout_height="50dp" android:layout_gravity="bottom|end" android:background="@drawable/selector_btn_cancel" /> </FrameLayout> </android.support.wearable.view.BoxInsetLayout>
So, the addition in FrameLayout does not work with id first_frame_layout. But in the official documentation you can read about android:padding="5dp" in FrameLayout
This line assigns padding to the internal FrameLayout element. This gasket applies to both square and round screens. The total filling between the buttons and window inserts is 20 dp on square screens (15 + 5) and 5 dp on round screens.
To quickly fix this problem: I added a new FrameLayout with id second_frame_layout as a child in FrameLayout with id first_frame_layout. I removed padding from first_frame_layout and added padding="5dp" to second_frame_layout. I got this result:


final activity_main.xml
<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout android:id="@+id/first_frame_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/red" app:layout_box="all"> <FrameLayout android:id="@+id/second_frame_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/green" android:padding="5dp"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Hello Android Wear" android:textColor="@color/black" /> <ImageButton android:layout_width="50dp" android:layout_height="50dp" android:layout_gravity="bottom|start" android:background="@drawable/selector_btn_ok" /> <ImageButton android:layout_width="50dp" android:layout_height="50dp" android:layout_gravity="bottom|end" android:background="@drawable/selector_btn_cancel" /> </FrameLayout> </FrameLayout> </android.support.wearable.view.BoxInsetLayout>
Now. It works the way I want on the Square and Round screens.
source share