Я создал генерического создателя листа Bootm. Нижний лист занимает менее половины экрана. Однако после открытия нижнего листа я не могу взаимодействовать с экраном за ним. Другая половина, где присутствует нижний лист, не позволяет мне настаивать на этой части экрана. < /P>
class GenericBottomSheet(private val bottomSheettheme : Int): BottomSheetDialogFragment() {
var customView: View? = null
lateinit var bottomSheet: View
lateinit var bottomSheetBehavior: BottomSheetBehavior
override fun getTheme(): Int = this.bottomSheettheme
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog = BottomSheetDialog(requireContext(), theme)
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.fragment_dynamic_bottom_sheet, container, false)
bottomSheet = view.findViewById(R.id.bottom_sheet)
bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet)
bottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
customView?.let {
val containerView = view.findViewById(R.id.dynamicContentContainer)
if (it.parent != null){
(it.parent as ViewGroup).removeView(it)
}
containerView.addView(it)
}
return view
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
companion object {
fun newInstance(customView: View,bottomSheettheme : Int = R.style.BottomSheetDialogTheme): GenericBottomSheet {
val fragment = GenericBottomSheet(bottomSheettheme)
fragment.customView = customView
return fragment
}
}
< /code>
} < /p>
fragment_dynamic_bottom_sheet.xml
Подробнее здесь: https://stackoverflow.com/questions/794 ... ack-screen
BottomSheetDialoGfragment не позволяет взаимодействовать с задним экраном ⇐ Android
Форум для тех, кто программирует под Android
1739612603
Anonymous
Я создал генерического создателя листа Bootm. Нижний лист занимает менее половины экрана. Однако после открытия нижнего листа я не могу взаимодействовать с экраном за ним. Другая половина, где присутствует нижний лист, не позволяет мне настаивать на этой части экрана. < /P>
class GenericBottomSheet(private val bottomSheettheme : Int): BottomSheetDialogFragment() {
var customView: View? = null
lateinit var bottomSheet: View
lateinit var bottomSheetBehavior: BottomSheetBehavior
override fun getTheme(): Int = this.bottomSheettheme
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog = BottomSheetDialog(requireContext(), theme)
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.fragment_dynamic_bottom_sheet, container, false)
bottomSheet = view.findViewById(R.id.bottom_sheet)
bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet)
bottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
customView?.let {
val containerView = view.findViewById(R.id.dynamicContentContainer)
if (it.parent != null){
(it.parent as ViewGroup).removeView(it)
}
containerView.addView(it)
}
return view
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
companion object {
fun newInstance(customView: View,bottomSheettheme : Int = R.style.BottomSheetDialogTheme): GenericBottomSheet {
val fragment = GenericBottomSheet(bottomSheettheme)
fragment.customView = customView
return fragment
}
}
< /code>
} < /p>
fragment_dynamic_bottom_sheet.xml
Подробнее здесь: [url]https://stackoverflow.com/questions/79441282/bottomsheetdialogfragment-not-letting-interaction-with-the-back-screen[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия