我将BottomSheetBehavior设置为在WebView上延伸。底部窗格中的Web视图有其自己的控制按钮。如何在这些按钮上方抬起整个BottomSheet块?
为清晰起见,我特别设置了半透明的背景。
是的,我注意到一个奇怪的功能,即离开BottomSheet主体下的所有内容都保持可单击状态,也就是说,通过单击此块,可以单击WebView。有时候这可能有用,但是现在这是一个问题,因为用户看不到他在点击什么。
bottom_sheet.xml:
<?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:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="340dp"
android:layout_alignParentBottom="false"
android:layout_marginBottom="50dp"
android:background="@color/common_google_signin_btn_text_light_default"
android:orientation="vertical"
android:paddingBottom="50dp"
app:behavior_hideable="true"
app:behavior_peekHeight="80dp"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<TextView
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@color/coloraccent"
android:gravity="center"
android:text="@string/profile_container"
android:textColor="@android:color/white" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:paddingBottom="50dp"
android:text="@string/recycle_packm_text3"
android:textColor="@android:color/white" />
activity.main.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.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"
tools:context="com.google.android.material.bottomsheet.BottomSheetBehavior">
<androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:keepScreenOn="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="false"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
</androidx.drawerlayout.widget.DrawerLayout>
<include layout="@layout/bottom_sheet" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
paddingBottom在此选项下不起作用:(
有人可以告诉我如何提高整个“底部”的底部边框以保持WebView底部可见吗?