<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:id="@+id/home_support_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/home_support_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginRight="@dimen/dp_16"
android:background="@drawable/icon_round_10_white_bg"
android:orientation="vertical">
<TextView
android:id="@+id/home_support_help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/dp_12"
android:text="@string/help_hint"
android:textColor="@color/color_666666"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/home_support_route"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/dp_12"
android:text="@string/route_navigation_hint"
android:textColor="@color/color_666666"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/home_support_close_mick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/dp_12"
android:text="@string/audiocall_stop_mute_audio"
android:textColor="@color/color_666666"
android:textSize="@dimen/sp_14" />
</androidx.appcompat.widget.LinearLayoutCompat>
<ImageView
android:id="@+id/home_support_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_16"
android:padding="@dimen/dp_12"
android:src="@mipmap/nav_ic_back"
android:visibility="gone"/>
</RelativeLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/support_info_parent_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_300"
android:layout_alignParentBottom="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="@id/home_support_layout">
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/support_info_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/white"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
app:layout_constraintStart_toStartOf="parent">
<!-- 运动结束、开始、继续上次-->
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_16"
android:orientation="horizontal">
<TextView
android:id="@+id/support_info_stop_support"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_2"
android:paddingBottom="@dimen/dp_2"
android:text="@string/stop_support_hint"
android:textColor="@color/color_666666"
android:textSize="@dimen/sp_10"
android:background="@drawable/circle"/>
<TextView
android:id="@+id/support_info_start"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_2"
android:paddingBottom="@dimen/dp_2"
android:text="@string/start_support_hint"
android:textColor="@color/color_666666"
android:textSize="@dimen/sp_10" />
<TextView
android:id="@+id/support_info_goon_support"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_2"
android:paddingBottom="@dimen/dp_2"
android:text="@string/go_on_support_hint"
android:textColor="@color/color_666666"
android:textSize="@dimen/sp_10" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
val behavior = BottomSheetBehavior.from<LinearLayoutCompat>(mChildVB!!.supportInfoLayout)
// BottomSheetBehavior.STATE_COLLAPSED //折叠
BottomSheetBehavior.STATE_HIDDEN;//隐藏
val se = BottomSheetBehavior.STATE_EXPANDED //展开
behavior.state = se
原文链接