简体   繁体   English

Android水平滚动视图不滚动

[英]Android horizontal scrollview not scrolling

I have include the scroll view in a horizontal way as follows but it not scrolling. 我已经以水平方式包含滚动视图,如下所示,但它不滚动。 Cannot find the issue. 找不到问题。 Cant we create a scroll view within ConstraintLayout? 我们不能在ConstraintLayout中创建滚动视图吗?

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                             xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
                                             android:layout_height="match_parent"
                                             xmlns:app="http://schemas.android.com/apk/res-auto">

    <ScrollView
                android:id="@+id/colors_scrollview"
                android:layout_width="250dp"
                android:layout_height="48dp"
                app:layout_constraintBottom_toTopOf="@+id/navigation"
                android:orientation="horizontal">

            <LinearLayout android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:orientation="horizontal">

                <View
                        android:layout_width="148dp"
                        android:clickable="true"
                        android:layout_height="48dp"
                        android:background="#2196F3" />

                <View
                        android:layout_width="148dp"
                        android:clickable="true"
                        android:layout_height="48dp"
                        android:background="#FFC107" />
           </LinearLayout>

     </ScrollView>
</android.support.constraint.ConstraintLayout>

如果要进行水平滚动,可以使用<HorizontalScrollView> </HorizontalScrollView>标记而不是<ScrollView>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM