Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.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
XML中的反向滚动视图_Xml_Android Layout_Scrollview - Fatal编程技术网

XML中的反向滚动视图

XML中的反向滚动视图,xml,android-layout,scrollview,Xml,Android Layout,Scrollview,我正在制作一个android应用程序,希望滚动从底部开始,然后用用户输入向上滚动。当前,滚动从底部开始,仅向上滑动滚动并在底部以错误方向显示空白。这是我的第一个项目,任何帮助都是感激的。谢谢 <androidx.core.widget.NestedScrollView android:id="@+id/scroll_view" android:layout_width="match_parent" android:layout

我正在制作一个android应用程序,希望滚动从底部开始,然后用用户输入向上滚动。当前,滚动从底部开始,仅向上滑动滚动并在底部以错误方向显示空白。这是我的第一个项目,任何帮助都是感激的。谢谢

<androidx.core.widget.NestedScrollView
    android:id="@+id/scroll_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="0dp"
    app:layout_constraintBottom_toBottomOf="parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="bottom"
        android:layout_marginStart="0dp"
        android:layout_marginEnd="0dp"
        android:layout_marginBottom="0dp"
        android:orientation="vertical">

    <androidx.cardview.widget.CardView
            android:id="@+id/redCard"
            android:layout_width="match_parent"
            android:layout_height="96dp"
            android:layout_marginStart="16dp"
            android:layout_marginEnd="16dp"
            android:layout_marginBottom="96dp"
            android:background="#FF5F5F"
            app:cardBackgroundColor="#F44336"
            app:cardCornerRadius="8dp">

            <ImageButton
                android:id="@+id/houseButton"
                android:layout_width="64dp"
                android:layout_height="64dp"
                android:layout_marginStart="16dp"
                android:layout_marginTop="16dp"
                android:background="#00FFFFFF"
                android:contentDescription="@string/app_name"
                android:scaleType="centerInside"
                android:src="@drawable/house_icon" />

            <ImageButton
                android:id="@+id/foodButton"
                android:layout_width="64dp"
                android:layout_height="64dp"
                android:layout_marginStart="96dp"
                android:layout_marginTop="16dp"
                android:background="#00FFFFFF"
                android:contentDescription="@string/app_name"
                android:scaleType="centerInside"
                app:srcCompat="@drawable/food_icon" />

        </androidx.cardview.widget.CardView>
     
        </LinearLayout>

</androidx.core.widget.NestedScrollView>

可以使用布局管理器在回收器视图上完成此操作,如果我们首先将布局管理器设置为
setReverseLayout(true)
并将其附加到回收器视图,则滚动将从底部以及其中的项目开始