I have a problem with a fragment layout for Wear project. I have a WearActivity which just hosts a FragmentContainerView to support navigation graph. Inside I have a HomeFragment with the following layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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="wrap_content"
app:boxedEdges="all">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:paddingBottom="32dp">
<LinearLayout
android:id="@+id/llWearContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical">
<ImageButton
android:id="@+id/notifications_ibtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center_horizontal"
android:background="@color/black"
android:src="@drawable/ic_notifications" />
<TextView
android:id="@+id/station_name_tv"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/spacing_normal"
android:text="12th St. Oakland City Center Station"
android:textColor="@android:color/white"
android:textStyle="bold" />
<TextView
android:id="@+id/find_station_tv"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/spacing_normal"
android:gravity="start"
android:maxLines="1"
android:text="@string/button_find_station"
android:textAlignment="textStart"
android:textAppearance="?attr/textAppearanceButton"
android:textColor="@color/find_change_station_color"
android:textSize="14sp" />
<TextView
android:id="@+id/find_station_tv1"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/spacing_normal"
android:gravity="start"
android:maxLines="1"
android:text="@string/button_find_station"
android:textAlignment="textStart"
android:textAppearance="?attr/textAppearanceButton"
android:textColor="@color/find_change_station_color"
android:textSize="14sp" />
<TextView
android:id="@+id/find_station_tv2"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/spacing_normal"
android:gravity="start"
android:maxLines="1"
android:text="@string/button_find_station"
android:textAlignment="textStart"
android:textAppearance="?attr/textAppearanceButton"
android:textColor="@color/find_change_station_color"
android:textSize="14sp" />
<TextView
android:id="@+id/find_station_tv3"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/spacing_normal"
android:gravity="start"
android:maxLines="1"
android:text="@string/button_find_station"
android:textAlignment="textStart"
android:textAppearance="?attr/textAppearanceButton"
android:textColor="@color/find_change_station_color"
android:textSize="14sp" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
Activity layout is just this:
<?xml version="1.0" encoding="utf-8"?>
<androidx.fragment.app.FragmentContainerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:navGraph="@navigation/nav_graph_wear" />
I've tried several other root viewgroups but the end result is always the same.