Android : Set drawable position inside button

on Friday, August 29, 2014


I've got a button and a drawable on the left of the text, but I want the drawable to be closer to the text. So I need to move the drawable.


I've defined android:drawableLeft but the content of the button is not centered.


Here is my code:



<Button
android:id="@+id/addsubject"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_action_add"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_marginTop="20dp"
android:text="@string/addsubject"
android:textColor="@color/white"
android:background="@drawable/custombutton1" />


Here is how it looks now:


enter image description here


And here is how I'd like it to be:


enter image description here


Thank you!


0 comments:

Post a Comment