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
(二)