Questions tagged [android-jetpack-compose-layout]
62 questions
0
votes
1 answer
Custom layout doesn't cause parent to wrap content in jetpack compose
So I have a layout with the following structure:
The layout is as follows:
Card(
modifier = Modifier.fillMaxWidth()
) {
Row(
modifier = Modifier
.height(IntrinsicSize.Min)
…

rohan
- 523
- 1
- 5
- 22
0
votes
1 answer
Why LazyColumn always seems not showing part of the custom layout view from left and right side?
I have code below which I experiment with LazyColumn and Column on CustomLayoutModifier on Text (or can be on anything).
@Composable
fun Greeting() {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
) {
…

Elye
- 53,639
- 54
- 212
- 474
0
votes
1 answer
Why the constraint offsetting behave like sizing (width/height) while the layout sizing (width/height) behave like offset
I have the following top-level code where a Box is centered on the device
@Composable
fun Greeting() {
Column(
horizontalAlignment = CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
val size = 240.dp
…

Elye
- 53,639
- 54
- 212
- 474
0
votes
1 answer
Why adding and subtracting Compose Placeable constraint behave differently?
When I set my pleaceable constraint as below.
LazyColumn(
contentPadding = PaddingValues(all =64.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
) {
val adjust = 32.dp
item {
Divider(modifier =…

Elye
- 53,639
- 54
- 212
- 474
0
votes
1 answer
Can a Compose LazyList be scrolled to adjust for keyboard?
I have been wrestling with IME padding/adjustment for my app. I have written a little toy app to try and focus on just the problem. The app presents a scrollable list of cards with info on them, the name is a simple BasicTextField. The code is at…

Travis Griggs
- 21,522
- 19
- 91
- 167
0
votes
1 answer
Jetpack Compose Row Item Positioning
I've struggled with this layout, which seems like it should be trivial, but I guess since I'm a somewhat beginner with Compose that I can't quite get it right.
All I want to do is have these two pieces of text aligned to Start and the red number…

clamum
- 1,237
- 10
- 18
0
votes
1 answer
What is the working logic of Row Arrangement in Android jetpack compose?
I've been currently developing and learning android jetpack compose and there are some things I don't know and wonder about this. One thing I'm wondering I'm trying to do a back button positioned in the upper left corner of the screen and a text…

NewPartizal
- 604
- 4
- 18
0
votes
2 answers
Jetpack compose snackbar not displayed at bottom of screen
I tried below code and I observe snackbar is not displayed at bottom of screen.
My task is to display snackbar on click of button.
I wrote code related to display button in a column in function DisplaySnackBarOnClik()
The code to display snackbar is…

Android_programmer_office
- 3,588
- 8
- 40
- 53
0
votes
1 answer
Jetpack compose - Building a column with children separated by a divider
I'm trying to build a custom Column whose children are separated by a divider that's provided to it. The divider should only be applied between children that are actually rendered.
I initially thought of trying to replicate Arrangement.separatedBy()…

Husayn Hakeem
- 4,184
- 1
- 16
- 31
0
votes
1 answer
Are words and space characters in a Text composable treated as separate Text objects?
Here is the code:
@Composable
fun MainScreen() {
var textState by remember { mutableStateOf("") }
val onTextChange = { text : String ->
textState = text
}
Column(Modifier.width(200.dp).padding(5.dp)) {
…

ntos
- 189
- 10
0
votes
1 answer
different alignments in compose row
(I'm pretty new to compose, so this might be a dumb question, beware :D)
I'm trying to achieve a layout that looks like this:
--------------------------
| Text1 |
| Text2ABitSmaller +|
| …

JustSightseeing
- 1,460
- 3
- 17
- 37
0
votes
0 answers
Jetpack Compose: Save composable size before configuration changes, then use that size after configuration changes
I am saving the size of a composable using the onSizeChanged modifier. I want to know what the size of the composable was during the previous configuration so that when the configuration changes, I can do a calculation with that size. However, I…

isaialvarado
- 35
- 6
0
votes
1 answer
How to align a Box in Compose in the Center not just the Content
Here is my Code ! ;) And my Box is aligned at the top left, but I want the box in the center. You know how I can do this?
OptIn(ExperimentalWearMaterialApi::class)
@Composable
fun OnTouch() {
val width = 100.dp
val squareSize…
0
votes
0 answers
Jetpack Compose: How to get size of a composable at a specific level in the modifier chain?
I want to use the fillMaxSize modifier on a composable, but I want to know the size of the composable before fillMaxSize is applied and save the size in a mutable map.
I tried
.fillMaxSize()
.onSizeChanged {
sizes[page] = it
}
and also…

isaialvarado
- 35
- 6
0
votes
0 answers
Padding for Text() within Column not working?
I have a Jetpack Compose composable in a column beginning with a icon, title, textbody and a pager row:
Box(modifier = Modifier
.fillMaxSize()
.background(color = TVTheme.colors.blue)
) {
val bigPadding = 334.dp
val smallPadding = 24.dp
…

Ralf Wickum
- 2,850
- 9
- 55
- 103