【发布时间】:2020-09-07 02:50:52
【问题描述】:
我正在制作一个 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>
【问题讨论】:
标签: xml android-layout scrollview