I try make layout with two TextView and one Linear Layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/holo_orange_dark"
android:text="testsdddddddddddddddddddddddddddasdsdfsdfsdf"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/holo_red_dark"
android:maxLines="1"
android:text="NOT HIDE TEXT"/>
</LinearLayout>
But when the first element has many characters second text is hidding.
But I want to do so:
And when first text is short (or second element may not fill all aviliable area):
How i can do it? May be i need use RelativeLayout?
Big thanks for your answers!)
How about something like below? You just need to add another view that will fill the empty space after "NOT HIDE TEXT" and will look exactly alike.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="40dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/holo_orange_dark"
android:ellipsize="end"
android:lines="1"
android:text="testsdddddddddddddddddddddddddddasdsdfsdfsdf" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@android:color/holo_red_dark"
android:text="NOT HIDE TEXT" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/holo_red_dark" />
</LinearLayout>