14,343 questions
1
vote
1
answer
306
views
How to use the Material3 Expressive ButtonGroup with the animatedWidth Modifier?
During the Google IO 2025, they presented a new ButtonGroup Composable that animates the width of the contained Buttons once they are clicked. However, the latest non-deprecated overload does not ...
1
vote
1
answer
61
views
Android & compose: embed camera preview to UI layout
I want to use only square crop of the image from sensor, therefore I want to have square preview in UI, other UI elements are supposed to be placed outside of preview. UI is built using jetpack ...
1
vote
1
answer
63
views
pointerInput in Canvas resets ViewModel's state to its previous value
I have a composable which uses Canvas to draw tasks on a clock-like dial. The tasks are read from a ViewModel state, which in turn loads them from a database. The list of tasks varies depending on the ...
1
vote
2
answers
156
views
Lifecycle of ViewModel injected in root composable
I am facing weird behaviour in my application and it's probably because of lifecycle of ViewModel (injected in root composable), but I can't find any information about it in documentation.
Problem:
...
1
vote
1
answer
58
views
compose.material3 TopAppBar has a color transition effect when switching between light and dark mode
topBar = {
TopAppBar(
title = { Text("Norm Calculator") },
actions = {
IconButton(onClick = onThemeToggle) {
Icon(
...
1
vote
0
answers
115
views
Cannot request focus back on SliderThumb in RangeSlider compose
I've got the following case:
The user has a list of elements, including a range slider, if the range slider is changed (or any of the elements in the list) the entire list should get refreshed with ...
1
vote
1
answer
183
views
How to see preview for composable dark and light with background in compose multiplatform?
I'm using Compose Multiplatform 1.8.2 and in my commonMain, I have the following composable function with a preview:
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout....
0
votes
1
answer
60
views
Android app crashes on launch: java.lang.ClassNotFoundException for existing Composable screen class
I'm building a Quran app using Jetpack Compose in Kotlin. The app builds successfully and installs on a real Android device (Samsung S908E), but crashes instantly on launch.
Crash Log:
Caused by: java....
2
votes
1
answer
96
views
Composable isn't updating when I change input to the Room using StateFlow and collectAsStateWithLifecycle [closed]
My UI is not updating to show the new list of items when I change customers.
I have a Composable screen to display the customer and a list of the items for that customer. When I select a new customer, ...
2
votes
1
answer
184
views
Struggling to Get Signed-In Google User Session Using New Credential Manager API
I'm updating my app to use the new Credential Manager API for authenticating users via Firebase with Google Sign-In, since the previous approach using GoogleSignIn.getSignedInAccountFromIntent is now ...
3
votes
2
answers
80
views
How to control text wrapping behaviour of two multiline text inside a Row in Jetpack compose?
How to achieve this behaviour in Jetpack compose using Row with two Text composables?
I have tried using Modifier.weight(1f) as below, but that only works assuming both text are longer than half the ...
0
votes
1
answer
85
views
How to remove vertical padding from text in Jetpack Compose
Vertical padding is added to every text in my application. I understand that it is necessary for the correct display of text in multiple lines. However, in my case, it is crucial to remove these ...
2
votes
1
answer
97
views
How, in Compose, set the size of an element to a specific children's size?
The setup
In Jetpack Compose, I have a Column (gray) with two elements, a long text (yellow) and a short text (cyan):
@Composable
@Preview
fun Foo() = Column(
Modifier
.background(Color....
0
votes
1
answer
63
views
@Composable invocations can only happen from the context of a @Composable function Error Kotlin Jetpack Compose
With the code below I'm getting an error:
@Composable invocations can only happen from the context of a @Composable function
View:
Button(
onClick = {
val data = Data(str: String)
...
0
votes
1
answer
38
views
Can we use polymorphism to simplify LazyColumn code
I have an app which displays something like an activity stream, with different Composables for different types of Message.
The suggested approach for this uses a when statement, like:
items(
...
0
votes
1
answer
216
views
Jetpack Compose: draw behind navigation bar, navigationBarColor deprecated
I want my Android Jetpack Compose app to draw behind the system navigation bar, but not behind the system status bar.
I managed to do this, but for window.navigationBarColor I get the warning:
...
0
votes
1
answer
66
views
Color Difference when using ExoPlayer and PlayerView in android Compose
I'm using ExoPlayer and PlayerView to render videos in Compose as follows:
val exoPlayer = remember(videoUrl) {
ExoPlayer.Builder(this).build().apply {
setMediaItem(MediaItem....
1
vote
1
answer
373
views
Error with TextField Kotlin Jetpack Compose
With the code provided in Kotlin documentation, I'm getting the following error when implementing a TextField:
val state = rememberTextFieldState("Initial text", TextRange(0, 12))
TextField(...
1
vote
1
answer
189
views
How to simulate Android XR spatial navigation (as shown in Google I/O 2025) in emulator?
I'm currently experimenting with Android XR development and want to replicate the spatial navigation experience shown during Google I/O 2025, where the user moved smoothly between spatial panels and ...
2
votes
3
answers
271
views
Styling ButtonGroup Isn't Working Kotlin Jetpack Compose
With the code below, the ButtonGroup isn't styling as intended. I'd like the ButtonGroup itself to be wide enough to contain at least 5 buttons and scroll horizontally if necessary. However, the width ...
0
votes
1
answer
76
views
How to rotate the whole Android screen including system UI (keyboard)?
I'm wondering if there's any way to rotate not only the layout of the app, but the entire device screen, including system UI elements like the keyboard (IME), status bar, and navigation bar.
Currently,...
0
votes
1
answer
180
views
imepadding not working well in Compose Multiplatform
I have a BasicTextField which has imepadding applied, but once the keyboard is opened, It does not push up the contents of BasicTextField, It hides under the keyboard. I want it to scroll up above the ...
0
votes
0
answers
94
views
How to get the coordinate of Composable element?
I’m working on a Jetpack Compose app where I want a Text item in a LazyColumn become transparent as it scrolls under a semi-transparent TopAppBar. To achieve this, I’m using onGloballyPositioned to ...
2
votes
0
answers
89
views
Display BottomAppBar outside a Scaffold composable
I have all the screens inside a Scaffold and a NavHost:
Scaffold(
snackbarHost = {
SnackbarHost(hostState = snackbarHostState)
},
modifier = Modifier.fillMaxSize()
...
3
votes
2
answers
237
views
Android Kotlin: UI State is updated but the UI stays the same
The problem is the view model state and the content showing on the screen mismatches.
I have a shared ChatViewModel in two screens. It is initialized in the navigation as such:
val userId = "...