Android 如何对齐按钮中的文本
我想对齐左边按钮中的文本,但一点也不想 为了澄清,请查看图像中的红色圆圈 谢谢 (图中第一个是我的结果,第二个是我想要的) xml代码:Android 如何对齐按钮中的文本,android,button,alignment,Android,Button,Alignment,我想对齐左边按钮中的文本,但一点也不想 为了澄清,请查看图像中的红色圆圈 谢谢 (图中第一个是我的结果,第二个是我想要的) xml代码: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/activity_libretto" android:layout_width="match_parent" android:layout_height="wrap
<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"
/>
在按钮的xml中使用安卓:gravity=“left | center_vertical”
,您还可以将安卓:paddingLeft=“YOUR PADDING in dp”
添加安卓:gravity=“left | center_vertical”
<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 -->
那么您想将文本向左对齐吗?