samedi 28 mars 2015

How to make 2 horizontal buttons to fill relative layout equally?


Vote count:

0




ddd


the corresponding xml layout:



<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/buttons_holder"
android:layout_below="@+id/list_holder"
android:layout_alignParentBottom="true">

<ImageButton
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/previous_button"
android:src="@android:drawable/ic_media_previous"
android:layout_alignParentLeft="true"
android:minWidth="150dp"
android:layout_alignParentBottom="false"
android:layout_alignParentRight="false"
android:layout_alignParentTop="false"
android:scaleType="fitEnd" />

<ImageButton
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/forward_button"
android:src="@android:drawable/ic_media_next"
android:layout_alignParentRight="true"
android:minWidth="150dp"
android:scaleType="fitStart"
android:layout_alignWithParentIfMissing="false" />
</RelativeLayout>


I can change button's width just by setting


minWidth = 200dp maxWidth = 200dp


so the button will occupy fixed space inside my relative layout


but i want to do it the 'right way' - using probably gravity, but there is no gravity for button - only for my relative layout that holds these 2 buttons


How to properly make 2 buttons occupy equal space inside rel layout?



asked 1 min ago

ERJAN

3,584






How to make 2 horizontal buttons to fill relative layout equally?

Aucun commentaire:

Enregistrer un commentaire