我不明白为什么水平滚动视图不起作用,垂直滚动视图工作正常,有人可以澄清我吗?我在网上搜索了答案,但似乎没有任何效果,我已经尝试过嵌套滚动视图和列表视图。我的想法是创建一个测验,以垂直线性布局组织,但有些问题有多个复选框答案,而且它不适合屏幕的宽度,所以我尝试添加一个水平滚动视图,以便我可以访问所有没有格式错误的复选框。
<ScrollView
xmlns:android="http://schemas.android.co...
xmlns:app="http://schemas.android.com/ap...
xmlns:tools="http://schemas.android.com/...
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.android.quiz....
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Textview> </TextView>
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="match_parent"~
android:scrollbars="horizontal"
android:nestedScrollingEnabled="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<CheckBox><CheckBox/>
<LinearLayout/>
<HorizontalScrollView/>
<LinearLayout/>
<Scrollview/>
您可以将回收器视图添加到布局文件中
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_view"
xmlns:android="http://schemas.android.com/apk/res/android" />
在java文件中将其方向设置为水平
LinearLayoutManager LayoutManager = new LinearLayoutManager(this);
LayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
RecyclerView.setLayoutManager(LayoutManager);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句