Alternatively, you can make LinearLayout as follows:
<?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="wrap_content" android:orientation="horizontal" android:weightSum="100" android:gravity="center_vertical"> <LinearLayout android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="40"> <TextView android:layout_weight="1" android:layout_width="0dip" android:layout_height="wrap_content" android:text="A very very very long text" android:singleLine="true" android:scrollHorizontally="true" android:ellipsize="end"> </TextView> </LinearLayout> <LinearLayout android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="60"> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="TextBox"> </EditText> </LinearLayout> </LinearLayout>
To adjust the column widths, change the layout_weight each LinearLayout container. A small value means a smaller width, and both weights should be 100.
source share