Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/208.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何创建水平列表视图?安卓_Java_Android_Horizontal Scrolling - Fatal编程技术网

Java 如何创建水平列表视图?安卓

Java 如何创建水平列表视图?安卓,java,android,horizontal-scrolling,Java,Android,Horizontal Scrolling,我很难创建一个水平列表视图,我希望所有的项目都可以水平滚动。我试过了,但列表仍然以常规格式显示 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

我很难创建一个水平列表视图,我希望所有的项目都可以水平滚动。我试过了,但列表仍然以常规格式显示

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TEST TO SEE IF HORIZ"/>
<HorizontalScrollView
    android:layout_width="wrap_content"
    android:layout_height="fill_parent">



        <ListView
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:id="@+id/listViewGlobal"
            android:ori>

            </ListView>


    </HorizontalScrollView>
</RelativeLayout>

您的问题是将
列表视图
放在
水平滚动视图
中,而您遇到的垂直滚动是由
列表视图
引起的

更改
列表视图
中的
线性布局
以使其工作


另外,如果要创建水平列表,请查看以下内容:

1)
RecyclerView
GridLayoutManager.HORIZONTAL
LinearLayoutManager.HORIZONTAL

(二)