我尝试了所有我可能找到的对齐此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