android– 如何在relativeLayout中显示微调器旁边的标签

android– 如何在relativeLayout中显示微调器旁边的标签,第1张

概述我有以下RelativeLayout:<RelativeLayoutxmlns:android="http://schemas.android.com/apkes/android"xmlns:tools="http://schemas.android.comools"android:layout_width="match_parent"android:layout_height="match_parent&qu

我有以下relativeLayout:

<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"xmlns:tools="http://schemas.androID.com/tools"androID:layout_wIDth="match_parent"androID:layout_height="match_parent"androID:orIEntation="horizontal" ><RadioGroup    <!--stuff--></RadioGroup><SpinnerandroID:ID="@+ID/colour_spinner"androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"     androID:layout_below="@+ID/radioGroup1" /> <TextVIEw    androID:ID="@+ID/colourLabel"    androID:text="@string/label_colour"    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:layout_below="@+ID/radioGroup1"    androID:layout_toleftOf="@+ID/colour_spinner"/><SpinnerandroID:ID="@+ID/country_spinner"    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"     androID:layout_below="@+ID/colour_spinner" /><TextVIEw    androID:ID="@+ID/countryLabel"    androID:text="@string/label_country"    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:layout_below="@+ID/colour_spinner"    androID:layout_toleftOf="@+ID/country_spinner"/><Spinner    androID:ID="@+ID/stadium_spinner"    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"     androID:layout_below="@+ID/country_spinner" /><TextVIEw    androID:ID="@+ID/stadiumLabel"    androID:text="@string/label_stadium"    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:layout_below="@+ID/country_spinner"    androID:layout_toleftOf="@+ID/stadium_spinner"/>

希望我在这里尝试做的很明显.三个旋转器,每个都在前一个下方,每个左侧都有一个标签,理想情况下整齐排列.

我现在得到的结果是,只有微调显示在屏幕上,我根本没有文本标签.我在这做错了什么?我怀疑这与我的布局宽度/高度设置有关?

解决方法:

将每个微调器和标签包含在水平linearLayout中:

<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    xmlns:tools="http://schemas.androID.com/tools"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"><RadioGroup    androID:ID="@+ID/radioGroup"    androID:layout_wIDth="match_parent"    androID:layout_height="wrap_content" >    <!-- stuff --></RadioGroup><linearLayout    androID:ID="@+ID/spinner1"    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:layout_below="@+ID/radioGroup"    androID:orIEntation="horizontal" >    <TextVIEw        androID:ID="@+ID/colourLabel"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:text="@string/label_colour" />    <Spinner        androID:ID="@+ID/colour_spinner"        androID:layout_wIDth="0dp"        androID:layout_height="wrap_content"        androID:layout_weight="1" /></linearLayout><linearLayout    androID:ID="@+ID/spinner2"    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:layout_below="@+ID/spinner1"    androID:orIEntation="horizontal" >    <TextVIEw        androID:ID="@+ID/countryLabel"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:layout_weight="1"        androID:text="@string/label_country" />    <Spinner        androID:ID="@+ID/country_spinner"        androID:layout_wIDth="0dp"        androID:layout_height="wrap_content"        androID:layout_weight="1" /></linearLayout><linearLayout    androID:ID="@+ID/spinner3"    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:layout_below="@+ID/spinner2"    androID:orIEntation="horizontal" >    <TextVIEw        androID:ID="@+ID/stadiumLabel"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:text="@string/label_stadium" />    <Spinner        androID:ID="@+ID/stadium_spinner"        androID:layout_wIDth="0dp"        androID:layout_height="wrap_content"        androID:layout_weight="1" /></linearLayout></relativeLayout>
总结

以上是内存溢出为你收集整理的android – 如何在relativeLayout中显示微调器旁边的标签全部内容,希望文章能够帮你解决android – 如何在relativeLayout中显示微调器旁边的标签所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1110156.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存