I need button with text in the middle and icon left of text.
my button :
<Button
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:onClick=""
android:text="@string/search_button"
android:textColor="@drawable/button_text"
android:layout_weight="1"
android:background="@drawable/button"
android:drawableLeft="@drawable/new_star_nonactive" />
I need button with width fill_parent (all screen width)
but I have this :
How can I set image position center, near the text?
Then only way to do that, is to use padding. In your case you want the image to move to the right, so use android:paddingLeft="50dp"
or the amount of dips you want to move.
EDIT:
also add android:gravity="left | center"
in order to get the text right with the image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With