Alexander Maryanovsky
02/16/2023, 9:13 PMArrangement
that gives each item the same amount of “room” and then aligns within that room. Like if I put each item in a box of the same weight and aligned within the box?Alex
02/16/2023, 11:17 PMArrangement.SpaceEvenly
?Alexander Maryanovsky
02/17/2023, 9:45 AMSpaceEvenly
creates even spaces between the items, which is not the same.Rafs
02/17/2023, 11:29 AMArrangement.spacedBy(dp, Alignment)
cb
02/17/2023, 11:46 AMArrangement
doesn’t affect the measurement of items, only placement.Alexander Maryanovsky
02/17/2023, 11:47 AMAlexander Maryanovsky
02/17/2023, 11:47 AMprivate fun placeEqually(
totalSize: Int,
size: IntArray,
outPosition: IntArray,
reverseInput: Boolean
) {
val itemRoom = totalSize / size.size
var current = 0
size.forEachIndexed(reverseInput) { index, it ->
outPosition[index] = current + (itemRoom - it)/2
current += itemRoom
}
}
Alexander Maryanovsky
02/17/2023, 11:48 AMcb
02/17/2023, 11:49 AMcb
02/17/2023, 11:50 AMAlexander Maryanovsky
02/17/2023, 11:51 AMcb
02/17/2023, 11:52 AManimateContentSize
Alexander Maryanovsky
02/17/2023, 11:53 AMcb
02/17/2023, 11:54 AMArrangement
exists and is easy to use for custom behaviorAlexander Maryanovsky
02/17/2023, 11:59 AMIntArray.forEachIndexed(reversed: Boolean, action: (Int, Int) -> Unit)
wasn’t private