屏幕下方的微调器下拉项目

时间:2017-03-01 06:31:04

标签: android android-spinner

如何防止微调器下拉项目超出屏幕? PS可滚动不起作用。 超出屏幕用户的微调器下拉项目无法从微调器中选择更多项目。 发现增加旋转器高度可以解决问题,但它使设计变得更糟。 enter image description here

<ScrollView>
        <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:background="@color/white">
        <Spinner
            android:id="@+id/bank"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="@dimen/normal_text"
            android:textColor="@color/black"
            android:padding="10dp"
            android:forceHasOverlappingRendering="false"
            android:scrollbars="vertical" />
    </LinearLayout>
</ScrollView>

1 个答案:

答案 0 :(得分:1)

您不需要使用ScrollView。如有必要,它会自动滚动。

仅使用以下内容:

<Spinner
    android:id="@+id/planets_spinner"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

如果您在此示例中完全按照此方式操作,它将滚动得很好:https://developer.android.com/guide/topics/ui/controls/spinner.html

基本上,请取出ScrollView和LinearLayout。你不需要它们。