我使用导航控制器显示了底部工作表,但未显示背景可绘制对象
当我使用时:
<dialog
android:id="@+id/countriesBottomSheet"
android:name="ru.ttcreate.nravki.ui.screens.login.authorization.CountryBottomSheetFragment"
tools:layout="@layout/login_bottom_sheet_countries" />
findNavController().navigate(R.id.countriesBottomSheet)
我明白了:
当我使用时:
val bottomSheetBehaviorCountries = BottomSheetBehavior.from<LinearLayout>(binding.bottomSheetCountries as LinearLayout?)
bottomSheetBehaviorCountries.state = BottomSheetBehavior.STATE_EXPANDED
我明白了:
login_bottom_sheet_countries.xml的根LinearLayout:
<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="182dp"
android:background="@drawable/rect_top_corners_white"
android:orientation="vertical"
app:behavior_hideable="true"
app:behavior_peekHeight="0dp"
android:clickable="true"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
android:focusable="true">