Here is my layout file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              android:orientation="horizontal"
              android:layout_width="match_parent"
              android:layout_height="80dp">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:textSize="50sp"
            android:background="#FFFF00"
            android:ellipsize="end"
            android:maxLines="1"
            tools:text="THIS IS A LONG SENTENCE"
            />
        <RelativeLayout
            android:layout_width="50dp"
            android:layout_height="match_parent"
            android:background="#0000FF"
            android:padding="4dp">
        </RelativeLayout>
</LinearLayout>
Here is the layout result:
I found the textview will occupy the neighbor relativelayout's space.
What I expect is:
For long sentence:
And for short sentence:
That is, I want the width of blue block to be fixed and to be right of the textview. How to to that ? Thanks.



 
     
     
    

 
     
    