问题描述
默认情况下,它位于STATE_EXPANDED,STATE_COLLAPSED等,但是我希望用户将其拖动到某个高度并保持它的高度,但是底部工作表将转到预定义状态之一(STATE_EXPANDED,STATE_COLLAPSED)并更改其高度。这是我的底页:STATE_EXPANDED STATE_COLLAPSED
<?xml version="1.0" encoding="utf-8"?>
<layout
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">
<data>
<variable name="bottomSheetHeight" type="float" />
</data>
<LinearLayout
android:id="@+id/bottom_sheet"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bgc1"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
app:behavior_hideable="false"
app:behavior_peekHeight="30dp"
app:behavior_draggable="true"
tools:viewBindingIgnore="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="?attr/bgc2">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/history"
android:textColor="?attr/titleTextColorAttr"
android:background="@null"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/history_recycler_view"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_width="match_parent"
android:layout_height="@{bottomSheetHeight,default = @dimen/bottomSheetHeight}"
android:background="@null" />
</LinearLayout>
</layout>
我真的不明白如何使它保持任何高度,请帮忙!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)