Pablo
11/25/2024, 10:51 PMModifier.fillMaxWidth()
doesn't work on Row
with horizontal scroll enabled. I need it to fill the entire width of the screen, but it is ignoring fillMaxWidth()
. On lazyrow
this issue was solved using fillParentMaxWidth()
on lazyrow
items... but that modifier is not available on Row.
Column(
modifier = Modifier.padding(paddingValues).verticalScroll(rememberScrollState()).fillMaxWidth().background(Color.Yellow)
) {
Row(
modifier = Modifier.horizontalScroll(rememberScrollState()).fillMaxWidth().background(Color.Green)
) {
AsyncImage(
model = imageRoute,
contentDescription = "",
contentScale = ContentScale.FillWidth,
modifier = modifier.fillMaxWidth().background(Color.Red)
)
}
}
The image is filling only around 75% of the width of the screen... can't understand whyStylianos Gakis
11/25/2024, 11:01 PMInt.MAX_VALUE
aka infinite.
Do you perhaps want a Pager here? Or if not, can you just use a lazy row?Pablo
11/26/2024, 9:36 AM.heightIn(max = Short.MAX_VALUE.toInt().dp)
on the column and
.widthIn(max = Short.MAX_VALUE.toInt().dp)
on the row, but it gives then this exception: java.lang.IllegalArgumentException: Can't represent a width of 86013 and height of 86013 in Constraints
Stylianos Gakis
11/26/2024, 9:37 AMPablo
11/26/2024, 9:39 AMPablo
11/26/2024, 9:40 AMPablo
11/26/2024, 9:40 AMStylianos Gakis
11/26/2024, 9:41 AMPablo
11/26/2024, 9:41 AMPablo
11/26/2024, 9:41 AMPablo
11/26/2024, 9:41 AMPablo
11/26/2024, 9:41 AMPablo
11/26/2024, 9:42 AMPablo
11/26/2024, 9:42 AMPablo
11/26/2024, 9:42 AMPablo
11/26/2024, 9:47 AMPablo
11/26/2024, 9:47 AMPablo
11/26/2024, 10:20 AMval configuration = LocalConfiguration.current
val screenWidth = configuration.screenWidthDp.dp
val screenHeight = configuration.screenHeightDp.dp
Column(
modifier = Modifier.padding(paddingValues)
.verticalScroll(rememberScrollState())
.fillMaxWidth()
.heightIn(max = screenHeight*2)
.background(Color.Yellow)
) {
Row(
modifier = Modifier.horizontalScroll(rememberScrollState())
.widthIn(max = screenWidth*2)
.background(Color.Green)
) {
Seems that Short.MAX_VALUE.toInt().dp was too much for a Column and a Row... lazycolumn and lazyrow instead are capable of measure thatPablo
11/26/2024, 10:23 AMPablo
11/26/2024, 10:25 AMmodifier.fillMaxWidth(0.5f)
on the image sets the image to 100% of the screen widthPablo
11/26/2024, 10:25 AM