Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distance between icon and text in the Button

I have a button defined in the XML shown below:

<Button
    android:layout_width="@dimen/logo_menu_width"
    android:layout_height="@dimen/logo_menu_height"
    android:layout_margin="@dimen/logo_menu_margins"
    android:gravity="left|center_vertical"
    android:background="@drawable/selector_blue"
    android:drawableStart="@drawable/ic_action_settings"
    android:paddingStart="6dp"
    android:text="Options"
    android:textColor="@color/blue_light"
    android:textSize="@dimen/logo_menu_text"
    android:id="@+id/buttonOptions"
    android:layout_gravity="center_horizontal" />

How to increase distance between icon (set with drawableStart) and text? Text alignment is set to left. paddingStart is set to 6dp, but it applies to icon only, not the text.

Is it possible to set it with XML file?

I know I can do this using LinearLayout - containing both ImageView and TextView, but I am trying to limit nesting of the views.

like image 683
Bartosz Ostrowski Avatar asked Aug 10 '14 19:08

Bartosz Ostrowski


1 Answers

Use the android:drawablePadding attribute.

like image 139
Karakuri Avatar answered Nov 14 '22 21:11

Karakuri