首页 > 解决方案 > 如何使我的底部工作表模式可滚动?

问题描述

我有一个带有这种布局的 BottomSheetDialogeFragment。我想滚动整个片段视图而不是仅滚动网格视图。我尝试使用滚动视图和 NestedScrollView 嵌套 LinearLayout,但在这两种情况下,模式甚至都不会滑到顶部。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:scrollbars="vertical">

    <ImageView
        android:background="@color/colorPrimary"
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/heart"
        android:scaleType="fitXY"
        android:adjustViewBounds="true"/>

    <GridView
        android:id="@+id/gridView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:stretchMode="columnWidth"
        android:gravity="center"
        android:numColumns="4" />
</LinearLayout>

标签: androidbottom-sheet

解决方案


推荐阅读