【发布时间】:2016-06-10 11:46:22
【问题描述】:
我正在使用微调器,用户可以选择他们的年龄,看起来像这样:
下拉箭头当前太靠右了。如何设置它以使微调器宽度仅与微调器项目内容所需的一样短?
布局的微调器部分的代码:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.4"
android:text="Age:" />
<Spinner
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/input_age_spinner"
android:layout_weight="0.6" />
</LinearLayout>
我尝试将微调器布局宽度设置为 wrap_content,但效果不大。而且我尝试将微调器 layout_weight 设置为 0.2,这确实使其变窄,但在这种情况下它不再左对齐
【问题讨论】:
标签: android android-layout android-widget android-xml