Reputation: 141
I want align the text in my button on the left, but not at all.
for clarifying, look at the red circle in the image.
Thanks.
(the first in the image is my result, the secondo what i'll want)
xml code :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_libretto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical"
>
<Button
android:id="@+id/button"
style="?android:attr/borderlessButtonStyle"
android:textAllCaps="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:text="Buongiorno!"
android:textSize="19dp"
android:textStyle="bold"
android:layout_marginTop="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="20dp"
android:gravity="left|center_vertical"
android:background="@drawable/bg_button"
android:drawableRight="@drawable/arrow"
/>
Upvotes: 3
Views: 3153
Reputation: 7929
Add android:gravity="left|center_vertical"
to your button.
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"
android:gravity="left|center_vertical"/> <!-- this line -->
Upvotes: 2
Reputation:
Use android:gravity="left|center_vertical"
in button's xml, and you can also add android:paddingLeft="YOUR PADDING IN dp"
Upvotes: 5