According to the things shown on Google IO 2014, you should use BoxInsetLayout :
Watch this video <- about 6:04
You can see the use of BoxInsetLayout in the DelayedConfirmation sample code. Here is the contents of the main_activity.xml file:
<?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" android:layout_height="match_parent" android:layout_width="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@color/grey" app:layout_box="top"> [...] </LinearLayout> </android.support.wearable.view.BoxInsetLayout>
You can set the following values for the application: layout_box: left|top|right|bottom or all . You can use all in your case, then all content will be stored inside the box on all sides. The effect for this layout is ignored when the application runs on a square clock.
EDIT:
I just checked the code you posted as “not working”:
<?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" android:layout_height="match_parent" android:layout_width="match_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1234567890" app:layout_box="all"/> </android.support.wearable.view.BoxInsetLayout>
With activity:
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
I told you to use the all value in layout_box , but even with top it works the same way it should:
app:layout_box="top" : (top offset only)

app:layout_box="all" : (offset from either side)

source share