如何在底页xml中提供滚动视图?

时间:2019-02-06 22:48:44

标签: android scrollview bottom-sheet

我有一个放置底页的屏幕。问题是,当我向上滚动底部页面时,它会展开,但底部页面不会滚动。我有一个可水平滚动和2个图像视图的线性布局,但页面不可垂直滚动,因此我可以看到所有3个元素。当我将滚动视图放在底部工作表xml中时,第一个内容以折叠状态滚动,然后底部工作表正在扩展。如何使其滚动。

代码如下:

Main Screen.xml

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

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_gravity="center"
        android:layout_height="match_parent"/>

    <include layout="@layout/bottom_sheet_clone" />

</android.support.design.widget.CoordinatorLayout>

BottomSheet.xml

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/bottom_sheet_clone"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:behavior_peekHeight="60dp"
    android:background="@color/black"
    app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearScrollView">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/idRecyclerViewHorizontalList"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
    </LinearLayout>

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/poster1"
        android:layout_below="@+id/linearScrollView"
        android:layout_marginTop="10dp"
        android:src="@drawable/bs4"
        android:scaleType="centerCrop"/>

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/poster2"
        android:layout_below="@+id/poster1"
    android:layout_marginTop="10dp"/>

</RelativeLayout>

0 个答案:

没有答案
相关问题