LinearLayout We have a LinearLayout with Horizontal orientation, and a EditText, a Button inside.
If we want both the EditText and the Button take half width of the screen, set both of them:
x
android:layout_width="0dp"android:layout_weight="1"The EditText take 2/3, and the Button take 1/3 of the screen,
In EditText:
x
android:layout_width="0dp"android:layout_weight="2"In Button:
xxxxxxxxxxandroid:layout_width="0dp"android:layout_weight="1"