Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create android button bar?

I need to create a horizontal list of buttons without a separating space like this one enter image description here buttonbar
each button will contain a text and an icon I know about buttonbarlayout but it didn't work for me, please can someone help me, Thanks in advance

like image 984
Caroline Avatar asked Apr 30 '26 09:04

Caroline


1 Answers

<LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:drawableTop="@drawable/read"
        android:text="Rewards" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:drawableTop="@drawable/read"
        android:text="Places" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:drawableTop="@drawable/read"
        android:text="Challenges" />
</LinearLayout>

Use LinearLayout with horizontal orientation and three buttons with layout_weight=1

like image 114
Aravindraj Avatar answered May 05 '26 05:05

Aravindraj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!