0
這裏是我的代碼,我無法準確地保持雙方的文本視圖屏幕的中心中心兩個文本視圖水平對齊
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/home_background"
android:gravity="center_vertical"
tools:context="com.couchbunny.www.MainActivity">
<ImageView
android:id = "@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/icon"
android:layout_centerHorizontal = "true"
android:layout_centerVertical = "true"/>
<TextView
android:id="@+id/couch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="36sp"
android:lineSpacingExtra="19sp"
android:layout_below = "@id/icon"
android:layout_marginTop="10dp"
android:text="couch"
android:gravity="center_vertical|right"
android:textColor="#ffffff"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="36sp"
android:lineSpacingExtra="19sp"
android:layout_below = "@id/icon"
android:layout_toRightOf="@id/couch"
android:layout_marginTop="10dp"
android:text="bunny"
android:gravity="center_vertical"
android:textColor="#f7ca18"
/>
</RelativeLayout>
電流輸出
對我而言,如果你可以向我解釋你的代碼,那對我很有幫助。 – gates
你應該給重力中心佈局 – MinnuKaAnae
如果它幫助你,請接受 – MinnuKaAnae