https://kotlinlang.org logo
Join SlackCommunities
Powered by
# compose-android
  • e

    eenriquelopez

    04/08/2025, 12:21 PM
    I am trying to use a Preview to display a Composable that I am converting to a Bitmap, doing something like this:
    Copy code
    val fakeCanvas = Canvas()
    val composeView =
        ComposeView(parent.context)
            .apply {
                layoutParams = ViewGroup.LayoutParams(
                    ViewGroup.LayoutParams.WRAP_CONTENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT,
                )
                setParentCompositionContext(compositionContext)
                setContent(content)
            }
            .also(parent::addView)
    
    composeView.draw(fakeCanvas)
    
    composeView.measure(measureSpec, measureSpec)
    At this point,
    composeView.measureWidth
    or
    measuredHeight
    is zero. This only happens during the Preview, not when I am using the Composable itself. What happens differently during the preview process?
    r
    • 2
    • 13
  • h

    Hinaka

    04/10/2025, 4:18 PM
    I'm following this guide: https://developer.android.com/develop/ui/compose/layouts/adaptive/list-detail to implement an adaptive layout with a list and details pane. When I wrap my panes with
    AnimatedPane
    , the
    LaunchedEffect(Unit)
    inside my list pane gets triggered again when navigating back from the details pane. However, if I include the panes without using
    AnimatedPane
    , the effect only triggers once on the initial launch. Is this expected behavior when using
    AnimatedPane
    ?
    m
    • 2
    • 4
  • k

    Kevin Worth

    04/11/2025, 4:34 PM
    android:autoLink="web" • Does the development road map include implementing in Compose the functionality of `TextView`'s
    android:autoLink="web"
    attribute, in some form or another? • In the meantime, anyone have a suggested/preferred approach?
    d
    e
    c
    • 4
    • 12
  • s

    Sam

    04/13/2025, 8:17 PM
    Hello, I'm having a simple LazyVerticalGrid composable managing 10k items. Each item is just a coil image and text. When running this as a debug app, there is a lot of frame drops for a quick scroll (
    Choreographer: Skipped 69 frames! The application may be doing too much work on its main thread.
    ). I get the initial frame drops when the code is just being JITed, however, it doesn't seem to recover at all (testing in Android 12L). Can anyone give some pointers as to what is happening in the debug version?
    s
    • 2
    • 7
  • z

    Zeming

    04/14/2025, 7:32 AM
    Hi Compose Team: Today the Compose source suddenly report an error during gradle sync on my desktop(Ubuntu 20.04). I'm pretty sure it was working fine last week, compiling and running perfectly. I tried do "repo sync" this morning, but issue still occured, could you please give me some suggestion or instruction to fix it? Thanks a lot!
    Copy code
    org.jetbrains.kotlin.gradle.plugin.ide.dependencyResolvers.IdeVisibleMultiplatformSourceDependencyResolver failed on :jetpack-compose:material3:material3-adaptive-navigation-suite::jetpack-compose:material3:material3-adaptive-navigation-suite/commonMain
    java.io.FileNotFoundException: ~/androidx-main/out/androidx/compose/material3/material3/build/kotlinProjectStructureMetadata/kotlin-project-structure-metadata.json (No such file or directory)
    same 2
    s
    l
    • 3
    • 11
  • m

    Mahmoo

    04/16/2025, 4:19 AM
    Hey folks, do we have support for dynamic feature modules in compose? If not then what's the recommended approach to implement DFM. The usecase if that I've to implement a mapview(using GoogleMaps composable) within an existing screen that's already in compose.
    j
    e
    • 3
    • 4
  • a

    Adnan memon

    04/19/2025, 9:24 AM
    Hey folks, I'm working on a screen (let's call it Screen A) that displays a list using a LazyColumn. Each item in the list contains a Map view. The issue is that every time I navigate from another screen (Screen B, which doesn't contain any Map) back to Screen A, the Map inside each list item reloads. How should I avoid reloading the map in the list(Lazy Column)
    r
    c
    • 3
    • 4
  • y

    Yusuf Ibragimov

    04/21/2025, 6:02 AM
    Hi everyone, I have a question about navigation in compose, I have one screen which has parameters, When, I navigate to another screen from this screen, I cannot navigate back with parameters. Has someone found a solution for this problem?
    p
    s
    +2
    • 5
    • 8
  • m

    Matti MK

    04/22/2025, 5:14 PM
    Is there a recommended / optimal way to apply dimensions in Compose? For example, for
    padding
    or
    height
    ? The Compose Resources doc mentions the dimensionResource API, and it is used in some codelabs like Simple Animation with Jetpack Compose. This leads me to think we should maybe use the
    dimensionResource
    API. However, there are some other points that make me reconsider: • The Migrating to Jetpack Compose codelab mentions the following: "Compose provides convenient methods to get values from the
    dimens.xml
    ... With this, you have the View system as the source of truth" ◦ I'd rather stay away from the View system • Dimensions are not used anywhere in the NIA app, for example the
    Catalog.kt
    has multiple hardcoded padding values, for example here. ◦ NIA is not a small app, and as such I'd imagine they'd use the "best" approach available So far I can tell there's three clear options: 1. Hardcode dimensions 2. Use
    dimensionResource
    3. Use a
    CompositionLocalProvider
    to provide the values Opinions on which way to go?
    m
    • 2
    • 2
  • b

    buszi0809

    04/22/2025, 8:18 PM
    Just released a small library I've been working on: Boomerang – a lightweight solution for passing navigation results between screens in Jetpack Compose and AndroidX Fragment apps. For now it supports only Android platform, but I'm planning to make it multiplatform after wider adoption and feedback. If you’ve ever found yourself fighting with tightly coupled navigation flows or trying to pass data back from one screen to another in Compose (without a mess of callbacks, shared ViewModels or weirdly accessing the saved state of previous screen), Boomerang might be just for you. It’s inspired by the
    setFragmentResultListener
    pattern, but is designed to be modular, minimal, and easy to drop into both Compose and Fragment projects—no matter what navigation library you use. A few things I focused on: • Decoupling producers and consumers of navigation results • Preserving results across configuration changes and process death • Supporting mixed projects (Compose + Fragments) • Keeping dependencies minimal There’s a sample app in the repo showing both Compose and Fragment usage. Feedback, bug reports, and feature requests are all welcome! (via Github Issues) Repo: https://github.com/buszi/Boomerang
    c
    • 2
    • 1
  • m

    Md Anas Shikoh Shikoh

    04/24/2025, 6:47 AM
    While implementing LazyVerticalStaggeredGrid , it is placing items like this as shown in photo, what can i do to place item in sequential manner like 0 on left side , then 1 on right side and then again 2 on left side. I am doing this because i need to add different padding to left side elements and different to right side elements. Why i am doing this because my staggered grid has some elements that has full width span and i dont want to add padding to them only to items whose span is SingleLane.
  • a

    Ahmed

    04/24/2025, 6:53 AM
    Is something similar to this (swipe to reveal) available for
    non-wear
    ui? Is it okay to use
    wear
    dependency for mobile?
    y
    m
    • 3
    • 2
  • y

    Yusuf Ibragimov

    04/25/2025, 11:44 AM
    Hi everyone, How we can pass data class as a parameter in jetpack compose navigation library, I know new version of navigation library which we can pass data class as a parameter, but I'm using old version navigation, to move new version I need more time and structural changes. Are there any ways?
  • j

    Jonathan

    04/25/2025, 7:41 PM
    The project structure for a new/empty CMP/KMP project differs when creating from Android Studio vs the Kotlin Multiplatform Wizard site. Does anyone know why and if one is outdated?
    z
    • 2
    • 2
  • n

    Nat Strangerweather

    04/27/2025, 5:09 PM
    It looks like using
    NavigationSuiteScaffold
    does not allow Edge-to-Edge to function in Android 35. Is that correct or am I missing something?
    c
    • 2
    • 8
  • j

    Jonathan

    04/28/2025, 3:41 PM
    Does anyone know why the
    NavDestination.id
    is annotated with:
    Copy code
    @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
    In the JetBrains navigation library the same property in the native AndroidX Navigation library is publicly accessible.
    👀 1
    s
    • 2
    • 6
  • z

    Zoltan Demant

    04/29/2025, 9:00 AM
    Usually I can hold delete on my keyboard to continue deleting characters in input fields. This is no longer the case, using M3 and a pretty basic TextField with remember & mutableStateOf("").
    s
    h
    • 3
    • 20
  • r

    Rihards

    04/29/2025, 1:06 PM
    Hi! Are there any guidelines on how to better handle topbars in adaptive layouts? I previously had two separate fragments for the list and detail screens where different topbars were used - I’m wondering how to combine them into
    NavigableListDetailPaneScaffold
    .
    a
    • 2
    • 2
  • d

    dazza5000

    04/30/2025, 1:31 PM
    Does anyone have a solution for this? https://issuetracker.google.com/issues/414311585
  • a

    Andrey Beryukhov

    05/02/2025, 2:15 PM
    Hi. I need to have a transitive access from old XML files (android-only module) to drawables/strings put into composeResources of KMP module. Are there any ways to achieve it? I've tried Resources in the androidLibrary target but still have
    >Android resource linking failed
    . Probably because of trying to access them from another module.
  • m

    MarkRS

    05/04/2025, 11:05 AM
    The android-specific composables document says there's open issues in YouTrack for each such composable under a tag compose-commonization, but there seems to be no such tag.
  • e

    eygraber

    05/05/2025, 4:18 PM
    Anyone else find that enter/exit transitions using a spring animation spec are particularly janky in debug builds (release works fine)?
    👀 1
  • f

    FlowFan

    05/06/2025, 3:18 AM
    How can I track the visibility state of a page in
    VerticalPager
    ? I want to perform certain actions when a page becomes visible or hidden such as onResume/onPause in
    ViewPager2
    .
  • s

    Sergio Moral

    05/06/2025, 11:26 AM
    Hello everyone! Has anyone ever tried creating composables that instantiate their own ViewModel? I’m working on a
    LazyColumn
    that displays several composables, and I’d like each of them to manage their own logic independently. My use case: Each composable in the list has its own state — for example, a “like” button that can be either active or inactive. I think it would make sense for each item to have its own ViewModel, so it can connect to the Room database and manage its own state. I’ve tried a few approaches, but haven’t had much luck so far. I’d love to hear if anyone has tackled something similar and what worked for you. Thanks in advance!
    p
    c
    • 3
    • 8
  • r

    Rihards

    05/06/2025, 2:21 PM
    Hi! I would like to keep my app in the portrait mode mode for compact size devices and enable landscape mode for medium and expanded size screens. What’s the best way to handle that for the whole activity?
    c
    a
    • 3
    • 4
  • e

    eygraber

    05/08/2025, 3:47 AM
    Is there any way to use a styled AnnotatedString as a format arg for a string resource?
    m
    • 2
    • 1
  • a

    abbic

    05/08/2025, 10:56 AM
    is there any way to be able to view asset fonts in a composable preview? ie fonts created using this constructor
    Copy code
    @Stable
    fun Font(
        path: String,
        assetManager: AssetManager,
        weight: FontWeight = FontWeight.Normal,
        style: FontStyle = FontStyle.Normal,
        variationSettings: FontVariation.Settings = FontVariation.Settings(weight, style)
    ): Font = AndroidAssetFont(assetManager, path, weight, style, variationSettings)
    Not holding my breath but would be nice
    t
    • 2
    • 4
  • e

    eygraber

    05/11/2025, 2:47 AM
    Is
    autoSize
    for material3
    Text
    planned for 1.4 or will it not get added until 1.5?
    ➕ 1
  • m

    marlonlom

    05/11/2025, 7:11 PM
    Greetings, Question: is there a way to implement or add a confirmation dialog for android tv using jetpack compose and material3 ? In the image, a reference image for the dialog im trying to build using jetpack compose
    h
    • 2
    • 1
  • a

    Atul Kumar

    05/13/2025, 4:10 AM
    I am working on a Application in KMM, please suggest any good resource how to use same viewModel in android and in IOS where UI component are to shared with each other