How to make EditText
not grow to the side when text is entered into it?
Markup code ( EditText'ы
in the first two LinearLayout'ах
):
<?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="match_parent" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginRight="5dp" android:layout_weight="0.45" android:text="@string/id_sender" android:textColor="@color/black" android:textSize="17dp" /> <EditText android:id="@+id/edittext_sender" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.55" android:gravity="center" android:lines="1" android:textColor="@color/black" android:textSize="17dp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginRight="5dp" android:layout_weight="0.45" android:text="@string/id_recipient" android:textColor="@color/black" android:textSize="17dp" /> <EditText android:id="@+id/edittext_recipient" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.55" android:gravity="center" android:lines="1" android:textColor="@color/black" android:textSize="17dp" /> </LinearLayout> <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.25" android:layout_gravity="right" android:text="@string/login" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <Button android:id="@+id/button_start" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/start_forwarding" /> <Button android:id="@+id/button_stop" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/stop_forwarding" /> </LinearLayout> </LinearLayout>
weight
, but it still grows, "squeezing out"TextView
. - user189127