首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android将微调器与Textview右侧对齐

Android将微调器与Textview右侧对齐
EN

Stack Overflow用户
提问于 2014-03-17 00:11:10
回答 2查看 1.7K关注 0票数 0

我想把我的微调器对齐到文本视图的右边..但是微调器在右侧的文本视图底部..我在下面给出了我的代码,请帮助我,我需要做哪些更改才能更正。

xml

代码语言:javascript
复制
<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" />
EN

回答 2

Stack Overflow用户

发布于 2014-04-28 20:02:01

你可以给android:alignBaseLine

票数 1
EN

Stack Overflow用户

发布于 2014-04-28 20:18:31

如果你是在LinearLayout中,你可以使用TableRow来水平放置它们。应该如下所示:

代码语言:javascript
复制
<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技巧。

希望它能帮上忙!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22439310

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档