36 questions
0
votes
1
answer
97
views
Android Compose SearchBar content alignment vertically?
I want to use SearchBar from Compose, but I need to set another height. However, the problem is that if I do this, then the EditText inside & all the content would remain fixed at the top. I need ...
0
votes
1
answer
65
views
Scroll the list to the bottom when the keyboard is fully shown in Compose
How to scroll the list to the bottom when keyboard is shown in Compose? Now I have the following solution:
val isImeVisible = WindowInsets.isImeVisible
LaunchedEffect(isImeVisible) {
if (...
1
vote
1
answer
269
views
How to make the first text item in the row grow in width up to 50%
It needs to make a row in the column, the row should have two text items, the second should right align the first text item.
And when the first text has longer text content, it should grow up to a max ...
5
votes
1
answer
199
views
How do I make a Text composable take up x% of the Row's width when there's a IconButton in the row?
I have a Row that has an icon button on the left, then 16dp padding, then a Text that takes up the remaining width in the Row, and finally on the right, another Text that should take up 25% of the ...
0
votes
1
answer
117
views
How do I align an icon in the top left of a Column that has verticalArrangement of Center
As title says, I have a compose Column where I center the contents vertically but I want an icon in top left.
0
votes
0
answers
120
views
Managing complex state tree with Compose and LazyList
I want to rebuild a highly interactive RecyclerView based list with a Compose LazyList.
The list is divided into categories, and these categories represent required options for a single selection. ...
3
votes
1
answer
255
views
Is there any way to use widthIn and weight in Jetpack Compose?
I have a screen with a 2 by 2 grid of rectangles. I want the rectangles to fill all available width only if the width of the square is 120dp. The width would not exceed 120dp even if there is possibly ...
1
vote
3
answers
9k
views
How to convert all content of a composable to Bitmap in Android Jetpack compose?
I am trying to convert all the content of a LazyColumn to bitmap, and then export it to a pdf file.
I did find this library to take screenshots of what is showing but not for all the content. Content ...
1
vote
0
answers
381
views
How to create a custom Layout which will be displayed as floating element in jetpack compose?
I have requirement to create a component which will be displayed by the nested child component but it should not be constrained inside to any it's parent component. And I can position it like top, ...
1
vote
0
answers
526
views
I want to add Figma Linear gradient to Jetpack Compose Linear Gradient
I use a Figma design to develop a android app using Jetpack Compose. I want to add a linear gradient to a button like in Figma design.
This is my Jetpack compose code. When I use this code the ...
0
votes
2
answers
586
views
Android Compose contraintLayout has a text inside, which if it's long -> it will go out of it's parent
This is my code:
@Preview
@Composable
private fun composable(){
ConstraintLayout(
modifier = Modifier
.padding(all = 8.dp)
) {
val (title, type) = createRefs()
...
0
votes
2
answers
1k
views
Prevent Text overlapping button in Compose Android
I created the view as below:
@Composable
fun DynamicMessageBanner(
title: String,
message: String,
clickableText: AnnotatedString,
onClickableTextClicked: () -> Unit,
...
1
vote
0
answers
330
views
Android MotionLayout, how can I change it's height?
How can I change the height of my motionLayout, when swiping.
With my current code, I can only translate a view (but then I will remain with grey there)
I need to modify it's size, as this header is ...
5
votes
3
answers
2k
views
draw round corners in canvas with drawArc
I'm trying to create a pie chart in Jetpack Compose. I'm trying to make corners round for each Pie in the Chart. But, I'm having issues making corner rounds. I tried using cap = StrokeCap.Round in ...
0
votes
0
answers
153
views
How to set lineHeight as multiple of default in Jetpack Composable?
I have the following code. As you can see, the lineHeight on the Text composable is being set to a specific SP. I think it would be better however if I could multiply the default lineHeight by a float ...
0
votes
2
answers
3k
views
Nested Scrolling in Android compose
I have a Column and inside the Column, I have a Spacer with a specific size and a LazyColumn.
What is happening now is that when I want to scroll, First LazyColumn starts to scrolling, and when it ...
9
votes
2
answers
14k
views
how to align button bottom center in jetpack compose?
I've been trying to align a button in Column from the bottom to the center for a while, but I couldn't succeed.
hear is my code:
NutritionHabitsScreen
@Composable
fun NutritionHabitsRoute(
...
12
votes
0
answers
1k
views
Android compose LazyRow inside LazyColumn gives junk behaviour
I am trying to create one compose screen with nested scroll behaviour. For that I am using lazyColumn as parent and inside that I do have multiple rows with layRow.
val scrollState = ...
1
vote
2
answers
4k
views
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 ...
1
vote
1
answer
366
views
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 |
| ...
4
votes
2
answers
4k
views
Jetpack Compose responsive size in ConstraintLayout - Dimension.fillToConstraints overwriting .sizeIn, .widthIn, .heightIn Modifier
Im trying to have a composable scale inside a ConstrainLayout until a specified max size (usually by setting the .sizeIn, .widthIn or .heightIn Modifier) is reached or the borders of the constraints ...
5
votes
1
answer
5k
views
How to show semi-transparent loading overlay above full Composable
I am trying to create a Composable that wraps another content Composable and displays a CircularProgressBar as an overlay on top of it, covering the whole content Composable.
I almost got it working ...
1
vote
0
answers
1k
views
how to scroll to the center of a LazyRow item?
The LazyRow LazyListState has the method animateScrollToItem which scrolls to the end of a list item
I want to scroll to the center of the listItem.
I can do that by passing a scrollOffset to the ...
1
vote
2
answers
3k
views
Jetpack Compose Constraint Layout Constraints not linking as expected
I'm using constrainAs with Jetpack Compose to constrain a list of options.
To the left of the text there is a space, I believe this is caused by the fact that I constrain the text box to the start to ...
4
votes
1
answer
948
views
How to draw cutout in PreviewView Android Compose?
I'm creating a QR Scanner where the preview view is blur except the centre square part, I was able to blur PreviewView but not able to think of a way to unblur the centre cutout part.
AndroidView(
...
3
votes
3
answers
1k
views
How to specify Arrangement.SpaceEvenly in a BottomAppBar?
This is the prototype of Row:
@Composable
public inline fun Row(
modifier: Modifier = Modifier,
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,
verticalAlignment: ...
4
votes
1
answer
2k
views
TextField overflow and softwrap not working with Compose Constraint Layout
I've been trying to build a list with a Card in it formatted like this:
The difficulty here is that the title e.g. "Bread" and ingredient name e.g. "Flour" can be very long and ...
53
votes
1
answer
14k
views
How to combine Arrangement.spacedBy() and Arrangement.Center in a Row.horizontalArrangement
Is it possible to combine Arrangement.spacedBy(16.dp) and Arrangement.Center in a Row.horizontalArrangement?
What I would like to do is to center the content horizontally and also set a default ...
6
votes
3
answers
3k
views
Create vertical chain with respect to other element in jetpack compose ConstraintLayout?
I want to chain title and description text centered with respect to image with chainStyle.Packed how to achieve this in jetpack compose.
when i use createVerticalChain() its create chain with respect ...
31
votes
5
answers
30k
views
How to align Text to Top, Bottom and Center Vertically in Jetpack Compose?
How can I align the text using Text composable function vertically. Is there a way to do it without having to add another extra view to contain the Text.
The textAlign parameter of Text only has the ...
21
votes
1
answer
10k
views
How to individually/separately align child composables inside a Row?
I'm new in jetpack compose and I'm trying to do a simple thing that I can't achieve it.
That I want to do is in the same row align one component, in this case a surface, at the start and the other one,...
6
votes
2
answers
2k
views
Icons getting disappears if the text is too long in Jetpack Compose
@Composable
fun TopAppBar(
name: String,
modifier: Modifier = Modifier
) {
Row(
modifier = modifier
.fillMaxWidth()
.padding(20.dp, 0.dp),
...
28
votes
2
answers
21k
views
Jetpack compose code to scroll down to the position of a specific UI element on clicking a Text
I am trying to scroll down to the position of a specific UI element on clicking a Text.
The code for my Text is:
Text(
"What is autosaving?",
...
10
votes
1
answer
9k
views
Jetpack Compose Constraint Layout constrains not linking
I'm using constrainAs with Jetpack Compose to constrain a list of wifi options to the top of the parent and then to the bottom of a text view. As seen from the photo my list isn't being constrained to ...
104
votes
7
answers
137k
views
Jetpack Compose - Centering Text
I am using Jetpack Compose to create a simple flash card.
The idea is that you click the flash card and it will give you the answer.
However, I am stuck on a basic problem.
Unfortunately... I could ...
74
votes
6
answers
104k
views
Weights in Jetpack compose
Is it possible to do weights in Jetpack Compose? For example, I'd like to set it up in such a way that one item is weighted as 1/3 of a layout, and the other takes up the remaining 2/3.
In the XML/...