Reputation: 3578
Each row of my WearableRecyclerView
has a TextView
. The contents of the TextViews
can vary in length, however, whenever the length of the text is long and needs to break, it is breaking incorrectly.
It makes more sense visually:
As you can see there is plenty of room on the first line but it's breaking early.
I don't know if it's the text itself. If I hardcode in the text, instead of setting it dynamically, it looks fine:
My row item code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/episode_row_item_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal">
<ImageView
android:id="@+id/episode_row_item_thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:visibility="gone"
/>
<TextView
android:id="@+id/episode_row_item_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/episode_row_item_thumbnail"
android:lines="2"
/>
<TextView
android:id="@+id/episode_row_item_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_below="@+id/episode_row_item_title"
android:layout_toEndOf="@+id/episode_row_item_thumbnail"
/>
</RelativeLayout>
In the Adapter
I'm just setting the TextView's
text in onBindViewHolder
via the setText
method.
Upvotes: 0
Views: 370
Reputation: 3578
Well, after posting this, I immediately found the answer. Adding this fixed it:
android:breakStrategy="simple"
Upvotes: 1