我的布局XML大致如下所示:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="fill_parent">
<android.support.v4.widget.NestedScrollView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/svDetail"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/llSomeDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.v4.widget.NestedScrollView
android:id="@+id/bottomSheetContent"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:clipToPadding="true"
app:behavior_hideable="true"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
据我所知,bottomSheetContent应该来自屏幕的底部,而不是视图的底部。 llSomeDetails有很多内容,因此通常会离开屏幕。
答案 0 :(得分:0)
试试这样:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="fill_parent">
<android.support.v4.widget.NestedScrollView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/svDetail"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/llSomeDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.v4.widget.NestedScrollView
android:id="@+id/bottomSheetContent"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:clipToPadding="true"
app:behavior_hideable="true"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
</android.support.v4.widget.NestedScrollView>
<!-- include your bottom sheet here -->
<include layout="@layout/bottom_sheet" />
</android.support.design.widget.CoordinatorLayout>
请注意,必须在单独的布局文件中创建底部工作表,然后将其导入主要活动的布局