我有一個按鈕幫助,右邊和左邊的邊距爲10dp。然後我在TextView
(水平居中)的左邊添加一個按鈕測試,在按鈕help
的下方,並向左對齊按鈕help
。關於對齊的佈局問題
問題在於按鈕測試並不完全對齊按鈕help
,如TextView
test1
在按鈕help
的右側。
我在做什麼錯?
這裏是我的佈局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
>
<TextView
android:id="@+id/mid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="1"
android:gravity="center"
/>
<Button
android:id="@+id/help"
android:text="Help"
android:layout_width="match_parent"
android:layout_marginTop="35dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/test"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/help"
android:layout_marginTop="5dp"
android:background="#87CEFF"
android:text="Test"
android:layout_toLeftOf="@id/mid"
android:layout_alignLeft="@id/help"
/>
<TextView
android:id="@+id/test1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/mid"
android:layout_alignBottom="@id/test"
android:layout_alignTop="@id/test"
android:layout_alignRight="@id/help"
android:text="test1\ntest2"
android:gravity="center"
android:textColor="#0000ff"
android:background="#00cc00"
/>
</RelativeLayout>
所以,你想要什麼。 如果您查看佈局的輸出,則按鈕測試沒有完全對齊按鈕幫助(按某些像素),您希望如何顯示視圖 –
。 textview test1無論是幫助的權利。 – narb
你的光線對齊只是給你任何背景顏色,幫助按鈕 –