Skip to main content

Questions tagged [android-jetpack-compose]

Jetpack Compose is Android’s modern toolkit for building native declarative UI made by Google. If you're targeting desktop with Compose for Desktop, use both this and [compose-desktop] tags.

android-jetpack-compose
35 votes
2 answers
54k views

Android Jetpack Compose width / height / size modifier vs requiredWidth / requiredHeight / requiredSize

Android Jetpack Compose contains width(), height() and size() layout modifiers as well as requiredWidth(), requiredHeight() and requiredSize(). What is the difference between these two sets of ...
Valeriy Katkov's user avatar
16 votes
1 answer
8k views

Jetpack Compose Scoped/Smart Recomposition

I'm doing experiments to comprehend recomposition and smart recomposition and made a sample Sorry for the colors, they are generated with Random.nextIn() to observe recomposition visually, setting ...
Thracian's user avatar
  • 59k
34 votes
5 answers
25k views

How can I get onTouchEvent in Jetpack Compose?

In normal view, we can have onTouchEvent override fun onTouchEvent(event: MotionEvent?): Boolean { when (event?.action) { MotionEvent.ACTION_DOWN -> {} ...
Elye's user avatar
  • 58.4k
41 votes
5 answers
24k views

Jetpack Compose - Order of Modifiers

Documentation says that Modifiers are applied from the left. But from this example it looks like they are applied from the right: First border and then padding because there is no space between text ...
ivoronline's user avatar
  • 1,019
12 votes
2 answers
11k views

Jetpack Compose lazy column all items recomposes when a single item update

I'm trying to do some list operations and I've run into the issue of all items recomposing when a single item update. https://prnt.sc/8_OAi1Krn-qg My models; data class Person(val id: Int, val name: ...
pcparticle's user avatar
7 votes
1 answer
6k views

How to get exact size without recomposition?

I need size of my composable to draw dynamic lines but I don't want to get size by: var size by remember { mutableStateOf(IntSize.Zero) } Modifier.onSizeChanged{size = it} or Modifier....
uniqueapps's user avatar
14 votes
3 answers
18k views

Jetpack Compose how does SubcomposeLayout work?

As can be seen in official documents there is layout named SubcomposeLayout defined as Analogue of Layout which allows to subcompose the actual content during the measuring stage for example to use ...
Thracian's user avatar
  • 59k
8 votes
1 answer
5k views

How to clip or cut a Composable?

How to clip or cut Composable content to have Image, Button or Composables to have custom shapes? This question is not about using Modifier.clip(), more like accomplishing task with alternative ...
Thracian's user avatar
  • 59k
63 votes
10 answers
59k views

How to get activity in compose

Is there a way to get current activity in compose function? @Composable fun CameraPreviewScreen() { val context = ContextAmbient.current if (ActivityCompat.checkSelfPermission( ...
ccd's user avatar
  • 6,630
14 votes
5 answers
7k views

Why the view keeps flashing when using jetpack navigation with Compose?

I have a login scren and when the login is successful and the view model updates the mutable state variable, my expectation is that a new composable function is called to show a new screen and the ...
Androider2's user avatar
11 votes
2 answers
4k views

Why does mutableStateOf without remember work sometimes?

I've been playing with Jetpack Compose Desktop. I noticed something I really don't understand: import androidx.compose.desktop.ui.tooling.preview.Preview import androidx.compose.material.Button import ...
BierDav's user avatar
  • 1,394
49 votes
11 answers
31k views

How can I detect keyboard opening and closing in jetpack compose?

The only way I've found in compose is to use accompanist-insets and that removes window insets. And such causes other problems with my app's layout. The Android way seems to be this and I could pass ...
mmm111mmm's user avatar
  • 3,915
46 votes
12 answers
36k views

Jetpack Compose collapsing toolbar

I can't find any documents on the matter, is there something similar to a CollapsingToolbar in Compose? All I found was a mention of it here, but nothing on how to set it up
Merig's user avatar
  • 1,971
101 votes
17 answers
57k views

Jetpack Compose Text hyperlink some section of the text

How can i add hyperlink to some section of the text of Text component? With buildAnnotatedString i can set link section blue and underlined as in image below, but how can i also turn that section ...
Thracian's user avatar
  • 59k
8 votes
3 answers
14k views

Different types of width in jetpack compose

I am working in textfield in jetpack compose. I want to build something like this TextField( value = value, onValueChange = { value = it }, ...
Vivek Modi's user avatar
  • 6,089

15 30 50 per page
1
2 3 4 5
88