我嘗試了所有我可能找到的對齊此EditText元素 - 但它不會。右對齊EditText - 無法讓它與任何屬性對齊
我在這裏錯過了什麼?正如你所看到的,我試過android:layout_alignParentRight = "true"
和android:layout_gravity="right"
,但沒有任何運氣。
ps。 linearLayout只是使用RelativeLayout的父元素中的一個元素,但我想這並不重要。
<LinearLayout android:id="@+id/block1"
android:layout_width="fill_parent"
android:paddingLeft = "4sp"
android:padding = "4sp"
android:layout_height="25sp"
android:layout_marginTop = "4sp"
android:layout_below="@+id/Settings_phoneNumbersLbl"
android:orientation="horizontal">
<TextView android:id="@+id/Settings_phoneNumbersT1"
android:textColor="#000000"
android:textSize="14sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Settings_phoneNumbersT1"
/>
<EditText android:id="@+id/myRightAlignedText"
android:layout_width="170sp"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:layout_alignParentRight = "true"
android:layout_gravity="right"
/>
</LinearLayout>
您正在使用水平方向。它將一個接一個地添加子視圖。所以我建議你使用RelativeLayout並使用layout_alignParentRight,它會起作用。或者在權重1的中間添加一個空白視圖。 –
您想要將edittext對齊或edittext的內容對齊????? – Aju