在下面的屏幕截图中,我试图让蓝色框中的文本在中心对齐.它是降低,需要提升一个像素或两个像素.我一直在玩填充,但它似乎没有任何影响.
布局XML在这里:
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="5dp"
xmlns:android="http://schemas.android.com/apk/res/android">
android:layout_width="60dp"
android:layout_height="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:background="@drawable/rectanglesegment"
android:gravity="center"
android:paddingBottom="2dp"
android:text="XXX" android:textSize="16sp"
android:textAppearance="?android:attr/textAppearanceMedium"/>
有什么建议?
在收到@Snicolas的反馈后,我现在有以下内容:
有了这个布局
android:layout_width="60dp"
android:layout_height="fill_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:background="@drawable/rectanglesegment"
android:gravity="center"
android:text="abv" android:textSize="16sp"
android:textAppearance="?android:attr/textAppearanceMedium"/>