In my application screen, i have two buttons. one is Activate and another is About. I want Activate in left side and About in right side and both will be same size. I write the below code:
<LinearLayout
android:id="@+id/layout2"
android:layout_width="fill_parent"
android:layout_height="60px"
android:layout_alignParentBottom="true"
android:background="@drawable/bottom_bar"
>
<Button
android:id="@+id/btnActivate"
android:layout_width="0dp"
android:layout_height="40px"
android:layout_marginTop="10px"
android:layout_weight="1.0"
android:text="Activate"
android:textColor="#000000"
>
</Button>
<Button
android:id="@+id/btnAbout"
android:layout_weight="1.0"
android:layout_width="0dp"
android:layout_height="40px"
android:layout_marginTop="10px"
android:text="About"
android:textColor="#000000"
>
</Button>
</LinearLayout>
Now both the button is coming with same size. But i want them with some specific width like 60 dp. How can i do that??
Thanks in advance.
By setting android:layout_weight to 1 for both buttons, you ask the buttons to expand and cover the whole width of the layout with equal width (weight).
Remove the android:layout_weight attribute and set android:layout_width to the desired width.