【发布时间】:2012-10-17 09:29:24
【问题描述】:
我正在尝试在 Scroll View 中容纳 4 个微调器。但我将无法做到这一点。 有什么办法可以在 Scroll View 中容纳微调器??
【问题讨论】:
标签: android android-layout android-widget
我正在尝试在 Scroll View 中容纳 4 个微调器。但我将无法做到这一点。 有什么办法可以在 Scroll View 中容纳微调器??
【问题讨论】:
标签: android android-layout android-widget
简单:
ScrollView 只能容纳一个直接的孩子,所以如果你把微调器放在 LinearLayout 里面,一切都会好起来的。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Spinner
android:id="@+id/spinner2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Spinner
android:id="@+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Spinner
android:id="@+id/spinner3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Spinner
android:id="@+id/spinner4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</ScrollView>
</LinearLayout>
【讨论】: