我想把我的微调器对齐到文本视图的右边..但是微调器在右侧的文本视图底部..我在下面给出了我的代码,请帮助我,我需要做哪些更改才能更正。
xml
<TextView
android:id="@+id/textView2"
android:layout_marginLeft="5dp"
android:layout_alignParentLeft="true"
android:layout_below="@+id/editText2"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/age"
android:textColor="#FFFFFF"
/>
<Spinner
android:id="@+id/spinner2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/textView2"
android:drawSelectorOnTop="true"
android:layout_below="@+id/editText2"
android:textColor="#FFFFFF"
android:layout_alignBaseline="@+id/textView2"
android:layout_alignLeft="@+id/editText1"
android:entries="@array/age_arrays"
android:prompt="@string/age_prompt" />发布于 2014-04-28 20:02:01
你可以给android:alignBaseLine
发布于 2014-04-28 20:18:31
如果你是在LinearLayout中,你可以使用TableRow来水平放置它们。应该如下所示:
<TableRow
android:id="@+id/tr"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:orientation = "horizontal">
<TextView
.......
android:weight = "2"/>
<Spinner
.......
android:weight = "1"/>
</TableRow>如果你在RelativeLayout中,你可以使用android:layout_toLeftOf ="@+id/textView2"
您也可以在RelativeLayout中使用TableRow技巧。
希望它能帮上忙!
https://stackoverflow.com/questions/22439310
复制相似问题