Skip to content Skip to sidebar Skip to footer

How To Separate Icons From Eachother Android

i have a navigation bar on the bottom of the screen. I have a set of 3 buttons in this navbar, the buttons have an icon as background button there's no space between eachother. I'v

Solution 1:

Apply margin or padding, for instance:

    <Button 
    android:layout_height="wrap_content" 
    android:id="@+id/back" 
    android:layout_width="wrap_content"
    android:background="@drawable/button"
    android:margin="10dip"
    />

Or:

    <Button 
    android:layout_height="wrap_content" 
    android:id="@+id/back" 
    android:layout_width="wrap_content"
    android:background="@drawable/button"
    android:marginLeft="10dip"
    android:marginRight="10dip"
    />

This could be useful for you: Difference between a View's Padding and Margin

Solution 2:

Have you tried putting an empty View in between?

<Buttonandroid:layout_height="wrap_content"android:id="@+id/back"android:layout_width="wrap_content"android:background="@drawable/button"
        /><Viewandroid:layout_width="2dip"android:layout_height="1dip"/><Buttonandroid:layout_height="wrap_content"android:id="@+id/home"android:layout_width="wrap_content"android:background="@drawable/button"
        /><Viewandroid:layout_width="2dip"android:layout_height="1dip"/><Buttonandroid:layout_height="wrap_content"android:id="@+id/next"android:layout_width="wrap_content"android:background="@drawable/button"
        />

Play with the width and height of it to suit your needs. It usually does the trick for me.

Post a Comment for "How To Separate Icons From Eachother Android"