It is easy to place one TextView at right of another TextView but when width on base TextView more than screen size right TextView became not visible.
My XML layout:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/messages"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:text="Messages" />
<TextView
android:id="@+id/counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:background="@drawable/bg_white_r30p0pl10"
android:drawableRight="@drawable/arrow_orange"
android:text="800" />
</LinearLayout>
How to make right TextView screen even if base TextView width is huge?
UPD:
In other words I need:
If first TextView is short:
|[ShotrTextView][TextView] |
If first TextView is long:
|[LooooooongTextVi...][TextView]|
The solution is TableLayout usage with shrinkColumns = 0
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:shrinkColumns="0" >
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/messages"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:text="Messages" />
<TextView
android:id="@+id/counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:background="@drawable/bg_white_r30p0pl10"
android:drawableRight="@drawable/arrow_orange"
android:text="800" />
</TableRow>
</TableLayout>