Why the button on the middle dissapears? Instead of stretch to fill all the width of their parent? And whereas when I set layout_height = 0dp it doest with height and fills their parent?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
Since the linear layout orientation is vertical, only remaining height will be occupied if the layout_weight is “1”, orientation is key here. if you want width to be shared, you might to change the orientation to “horizontal”. keep in mind that your children then will be placed horizontally.