Я использую Composeview внутри моего макета элемента Recyclerview для работы с JetPack Compose. У меня есть странная проблема, когда я открываю экран
ошибка
java.lang.IllegalStateException: Vertically scrollable component was measured with an infinity maximum height constraints, which is disallowed. One of the common reasons is nesting layouts like LazyColumn and Column(Modifier.verticalScroll()). If you want to add a header before the list of items please add a header as a separate item() before the main items() inside the LazyColumn scope. There are could be other reasons for this to happen: your ComposeView was added into a LinearLayout with some weight, you applied Modifier.wrapContentSize(unbounded = true) or wrote a custom layout. Please try to remove the source of infinite constraints in the hierarchy above the scrolling container.
Я попытался следовать за переполнением этого стека, но он не сработал
main_activity.xml
item_layout.xml
viewholder.kt
class OptionsViewHolder(val binding: ItemLayoutBinding) : Recyclerview.ViewHolder(binding.root) {
private val context = binding.root.context
companion object {
fun from(parent: ViewGroup): OptionsViewHolder {
return OptionsViewHolder(
ItemLayoutBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
)
)
}
}
fun bindChoice() {
binding.itemComposable.setContent {
BoxWithConstraints {
LazyColumn(
modifier = Modifier
.fillMaxWidth()
.height(this@BoxWithConstraints.maxHeight)
.verticalScroll(rememberScrollState())
) {
items(getOptions()) { option ->
Text(text = option)
}
}
}
}
}
private fun getOptions() = mutableListOf(
context.getString(R.string.monitor),
context.getString(R.string.pressure),
context.getString(R.string.not_sure)
)
}
Подробнее здесь: https://stackoverflow.com/questions/731 ... height-con
Вертикально прокручивать компонент измеряли с ограничениями максимальной высоты бесконечности, которые запрещены ⇐ Android
Форум для тех, кто программирует под Android
1756229279
Anonymous
Я использую Composeview внутри моего макета элемента Recyclerview для работы с JetPack Compose. У меня есть странная проблема, когда я открываю экран
[b] ошибка [/b]
java.lang.IllegalStateException: Vertically scrollable component was measured with an infinity maximum height constraints, which is disallowed. One of the common reasons is nesting layouts like LazyColumn and Column(Modifier.verticalScroll()). If you want to add a header before the list of items please add a header as a separate item() before the main items() inside the LazyColumn scope. There are could be other reasons for this to happen: your ComposeView was added into a LinearLayout with some weight, you applied Modifier.wrapContentSize(unbounded = true) or wrote a custom layout. Please try to remove the source of infinite constraints in the hierarchy above the scrolling container.
Я попытался следовать за переполнением этого стека, но он не сработал
[b] main_activity.xml[/b]
[b] item_layout.xml[/b]
[b] viewholder.kt[/b]
class OptionsViewHolder(val binding: ItemLayoutBinding) : Recyclerview.ViewHolder(binding.root) {
private val context = binding.root.context
companion object {
fun from(parent: ViewGroup): OptionsViewHolder {
return OptionsViewHolder(
ItemLayoutBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
)
)
}
}
fun bindChoice() {
binding.itemComposable.setContent {
BoxWithConstraints {
LazyColumn(
modifier = Modifier
.fillMaxWidth()
.height(this@BoxWithConstraints.maxHeight)
.verticalScroll(rememberScrollState())
) {
items(getOptions()) { option ->
Text(text = option)
}
}
}
}
}
private fun getOptions() = mutableListOf(
context.getString(R.string.monitor),
context.getString(R.string.pressure),
context.getString(R.string.not_sure)
)
}
Подробнее здесь: [url]https://stackoverflow.com/questions/73165390/vertically-scrollable-component-was-measured-with-an-infinity-maximum-height-con[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия