【问题标题】:How to add horizontal scroll view below a listview如何在列表视图下方添加水平滚动视图
【发布时间】:2017-03-29 05:35:00
【问题描述】:

如何将水平滚动视图置于列表视图下方?我有一个列表视图,下面是一个带有一堆单选按钮的水平滚动视图。这是我的代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/radioGroup">
    </ListView>

    <RadioGroup
        android:id="@+id/radioGroup"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal"
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true">

        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:button="@null"
            android:checked="true"
            android:gravity="center"
            android:padding="5dp"
            android:text="/>

        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:button="@null"
            android:gravity="center"
            android:padding="5dp"
            android:text="A-"/>


        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:button="@null"
            android:gravity="center"
            android:padding="5dp"
            android:text="B+"/>

        <RadioButton
            android:id="@+id/bNegative"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:button="@null"
            android:gravity="center"
            android:padding="5dp"
            android:text="/>

    </RadioGroup>

</RelativeLayout>

我需要能够正常滚动列表视图,即垂直滚动视图和水平滚动视图。现在我无法滚动列表视图,但可以滚动水平滚动视图。请帮帮我

【问题讨论】:

  • 您可以使用Recyclerview,它可以提供各种布局模式,如网格、垂直、水平、交错等。

标签: android listview horizontalscrollview


【解决方案1】:

通过设置recyclerview的方向,使用recyclerview根据您的要求水平和垂直滚动

滚动垂直设置方向

 android:orientation="vertical "

并滚动水平设置方向

 android:orientation="horizontal"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-01-15
    • 2019-05-17
    • 1970-01-01
    • 2014-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多