Questions tagged [android-jetpack-compose-canvas]
79 questions
1
vote
1 answer
How to use Jetpack Compose Canvas with Layout with dynamic size
I want to set androidx.compose.foundation.Canvas size dynamically after measuring measurables and placing placeables with layout function but Canvas requires a Modifier with specific size how can achieve this with Layout and Canvas and in efficient…

Thracian
- 43,021
- 16
- 133
- 222
1
vote
0 answers
How to create a image cropping widget with Jetpack Compose Canvas
I am trying to create an Image cropping widget with Jetpack Compose. And I believe I have to use Canvas for this. I made an initial attempt but I am stuck on the part where I have to create the cropping rectangle, translating it on image bounds,…

YMS98
- 26
- 1
- 2
1
vote
1 answer
Unable to Focus Anything other than TextField
I have already viewed other posts on the site. They suggest using the focusRequestor modifier and I've tried that.
val scope = rememberCoroutineScope()
val focusRequester = remember { FocusRequester() }
Text(
modifier = Modifier
…

Richard Onslow Roper
- 5,477
- 2
- 11
- 42
1
vote
1 answer
How to update position change of objects on canvas in Jetpack Compose?
The code below is working fine apart from the fact that once I have dragged my rectangles, I can only select them again by touching the area where they were before I moved them. I don't know how to update their position once I have dragged them. I…

Code Poet
- 6,222
- 2
- 29
- 50
0
votes
0 answers
Unwanted recomposition when using DrawScope
There is a simple piece of code, One button plus three components with random background colors. when I press the button, Two composables that used DrawScope are redrawn again (I think it is due to the ripple effect of the button).
Is it a…

ucMedia
- 4,105
- 4
- 38
- 46
0
votes
1 answer
How to crop specific areas of a container while preserving the shadow underneath in Jetpack Compose?
I have a container (Card, Box, or whatever..) that contains two problematic areas, marked with red circles. I need to crop these areas out while ensuring that the shadow underneath is preserved.
I have tried different approaches, but I couldn't…

C. Alen
- 184
- 1
- 10
0
votes
1 answer
How to draw with content side by side in jetpack compose
I am using to drawBehind in my Column. I want to draw side by side. I draw line to specific coordinate and want my Text side of it. I tried this code
@Preview(showBackground = true)
@Composable
fun ItemView() {
val names = listOf("Captain" to…

Kotlin Learner
- 3,995
- 6
- 47
- 127
0
votes
0 answers
Recomposition of Canvas in JetpackCompose when changing the converted data type
I'm want to make recomposition of floorMap when floor(floorState) is change. Variant to sum all paths to one and give this path a state is bad because in the next step I want make every roomPath and object a clickable.
Here is my Jetpack compose…

kong_zi
- 1
- 2
0
votes
0 answers
Simple image editing function with multible layers in Jetpack Compose Desktop
I chose to create a small program using Jetpack Compose for Desktop to solve my specific problem described here Image Processing with combined Batch- and manual mode
To realize this, i need UI components that allows me:
having multiple Images…

Tobias Wohlfarth
- 56
- 7
0
votes
1 answer
How to align centre text in other item of canvas in jetpack compose
I want to align my drawText centre of view in my canvas. I draw my Image view with the help of this answer. Now I want to drawText at above, but my Text is in centre of my view. It's little bit complicated but I'll show you in…

Kotlin Learner
- 3,995
- 6
- 47
- 127
0
votes
1 answer
How to draw transparent arc with line corner end in jetpack compose
I want to draw transparent arc after color gradient radius end. It sound confusing. I have progress bar in which I have end the line at X position. After that I want to show transparent arc space at X position with Line Gradient. I am trying to use…

Kotlin Learner
- 3,995
- 6
- 47
- 127
0
votes
2 answers
Jetpack Compose Animation skips to target value immediately
I'm trying to achieve a smooth animation of a simple round timer. Like this, but smoother
However it just skips to targetValue immediately and that's it there's no animation at all. I'm trying to do it like this:
@Composable
private fun…

Overpass
- 433
- 5
- 12
0
votes
1 answer
Jetpack Compose: How to draw a path like this
I wanted to show two points in this way:
Is there some reference that I can look up?

Diyorbek Hamdamov
- 33
- 4
0
votes
1 answer
Android: compose drawArc would not get centered within `Box`
I am trying to show progress using drawArc for compose. I have tried drawBehind modifier to draw a background circle and not trying to draw another circle on top of it to show the progress. The problems is, no matter what I try, the arc turns out to…

oop
- 124
- 1
- 9
0
votes
1 answer
How to apply PathEffect without using Stroke with Jetpack Compose?
I'm building a gooey effect as in gif below by combining PathEffects but as far as i know PathEffect can be applied to Stroke style only. Is there a Compose way to apply PathEffect while filling circles?
val discretePathEffect =…

Thracian
- 43,021
- 16
- 133
- 222