Close Menu
geekfence.comgeekfence.com
    What's Hot

    Another spyware maker caught distributing fake Android snooping apps

    April 24, 2026

    Deutsche Telekom considers merging with T-Mobile

    April 24, 2026

    Malaysia deepens national AI partnership with Microsoft, expanding whole-of-nation skilling across educators, enterprises, and communities

    April 24, 2026
    Facebook X (Twitter) Instagram
    • About Us
    • Contact Us
    Facebook Instagram
    geekfence.comgeekfence.com
    • Home
    • UK Tech News
    • AI
    • Big Data
    • Cyber Security
      • Cloud Computing
      • iOS Development
    • IoT
    • Mobile
    • Software
      • Software Development
      • Software Engineering
    • Technology
      • Green Technology
      • Nanotechnology
    • Telecom
    geekfence.comgeekfence.com
    Home»Mobile»What’s new in the Jetpack Compose April ’26 release
    Mobile

    What’s new in the Jetpack Compose April ’26 release

    AdminBy AdminApril 24, 2026No Comments9 Mins Read0 Views
    Facebook Twitter Pinterest LinkedIn Telegram Tumblr Email
    What’s new in the Jetpack Compose April ’26 release
    Share
    Facebook Twitter LinkedIn Pinterest Email


    Posted by Meghan Mehta, Android Developer Relations Engineer

    What’s new in the Jetpack Compose April ’26 release

    Today, the Jetpack Compose April ‘26 release is stable. This release contains version 1.11 of core Compose modules (see the full BOM mapping), shared element debug tools, trackpad events, and more. We also have a few experimental APIs that we’d love you to try out and give us feedback on.

    To use today’s release, upgrade your Compose BOM version to:

    implementation(platform("androidx.compose:compose-bom:2026.04.01"))

    Changes in Compose 1.11.0

    Coroutine execution in tests

    We’re introducing a major update to how Compose handles test timing. Following the opt-in period announced in Compose 1.10, the v2 testing APIs are now the default, and the v1 APIs have been deprecated. The key change is a shift in the default test dispatcher. While the v1 APIs relied on UnconfinedTestDispatcher, which executed coroutines immediately, the v2 APIs use the StandardTestDispatcher. This means that when a coroutine is launched in your tests, it is now queued and does not execute until the virtual clock is advanced.

    This better mimics production conditions, effectively flushing out race conditions and making your test suite significantly more robust and less flaky.

    To ensure your tests align with standard coroutine behavior and to avoid future compatibility issues, we strongly recommend migrating your test suite. Check out our comprehensive  migration guide for API mappings and common fixes.

    Shared element improvements and animation tooling

    We’ve also added some handy visual debugging tools for shared elements and Modifier.animatedBounds. You can now see exactly what’s happening under the hood—like target bounds, animation trajectories, and how many matches are found—making it much easier to spot why a transition might not be behaving as expected. To use the new tooling, simply surround your SharedTransitionLayout with the LookaheadAnimationVisualDebugging composable.

    LookaheadAnimationVisualDebugging(
        overlayColor = Color(0x4AE91E63),
        isEnabled = true,
        multipleMatchesColor = Color.Green,
        isShowKeylabelEnabled = false,
        unmatchedElementColor = Color.Red,
    ) {
        SharedTransitionLayout {
            CompositionLocalProvider(
                LocalSharedTransitionScope provides this,
            ) {
                // your content
            }
        }
    }

    Trackpad events

    We’ve revamped Compose support for trackpads, like built-in laptop trackpads, attachable trackpads for tablets, or external/virtual trackpads. Basic trackpad events will now generally be considered PointerType.Mouse events, aligning mouse and trackpad behavior to better match user expectations. Previously, these trackpad events were interpreted as fake touchscreen fingers of PointerType.Touch, which led to confusing user experiences. For example, clicking and dragging with a trackpad would scroll instead of selecting. By changing the pointer type these events have in the latest release of Compose, clicking and dragging with a trackpad will no longer scroll.

    We also added support for more complicated trackpad gestures as recognized by the platform since API 34, including two finger swipes and pinches. These gestures are automatically recognized by components like Modifier.scrollable and Modifier.transformable to have better behavior with trackpads.

    These changes improve behavior for trackpads across built-in components, with redundant touch slop removed, a more intuitive drag-and-drop starting gesture, double-click and triple-click selection in text fields, and desktop-styled context menus in text fields.

    To test trackpad behavior, there are new testing APIs with performTrackpadInput, which allow validating the behavior of your apps when being used with a trackpad. If you have custom gesture detectors, validate behavior across input types, including touchscreens, mice, trackpads, and styluses, and ensure support for mouse scroll wheels and trackpad gestures.

    Before After

    Before

    After

    Composition host defaults (Compose runtime)

    We introduced HostDefaultProvider, LocalHostDefaultProvider, HostDefaultKey, and ViewTreeHostDefaultKey to supply host-level services directly through compose-runtime. This removes the need for libraries to depend on compose-ui for lookups, better supporting Kotlin Multiplatform. To link these values to the composition tree, library authors can use compositionLocalWithHostDefaultOf to create a CompositionLocal that resolves defaults from the host.

    Preview wrappers

    Android Studio custom previews is a new feature that allows you to define exactly how the contents of a Compose preview are displayed.

    By implementing the PreviewWrapperProvider interface and applying the new @PreviewWrapper annotation, you can easily inject custom logic, such as applying a specific Theme. The annotation can be applied to a function annotated with @Composable and @Preview or @MultiPreview, offering a generic, easy-to-use solution that works across preview features and significantly reduces repetitive code.

    class ThemeWrapper: PreviewWrapper {

        @Composable

        override fun Wrap(content: @Composable (() -> Unit)) {

            JetsnackTheme {

                content()

            }

        }

    }

    @PreviewWrapperProvider(ThemeWrapper::class)

    @Preview

    @Composable

    private fun ButtonPreview() {

        // JetsnackTheme in effect

        Button(onClick = {}) {

            Text(text = "Demo")

        }

    }

    Deprecations and removals

    • As announced in the Compose 1.10 blog post, we’re deprecating Modifier.onFirstVisible(). Its name often led to misconceptions, particularly within lazy layouts, where it would trigger multiple times during scrolling. We recommend migrating to Modifier.onVisibilityChanged(), which allows for more precise manual tracking of visibility states tailored to your specific use case requirements.
    • The ComposeFoundationFlags.isTextFieldDpadNavigationEnabled flag was removed because D-pad navigation for TextFields is now always enabled by default. The new behavior ensures that the D-pad events from a gamepad or a TV remote first move the cursor in the given direction. The focus can move to another element only when the cursor reaches the end of the text.

    Upcoming APIs

    In the upcoming Compose 1.12.0 release, the compileSdk will be upgraded to compileSdk 37, with AGP 9 and all apps and libraries that depend on Compose inheriting this requirement. We recommend keeping up to date with the latest released versions, as Compose aims to promptly adopt new compileSdks to provide access to the latest Android features. Be sure to check out the documentation here for more information on which version of AGP is supported for different API levels.

    In Compose 1.11.0, the following APIs are introduced as @Experimental, and we look forward to hearing your feedback as you explore them in your apps. Note that @Experimental APIs are provided for early evaluation and feedback and may undergo significant changes or removal in future releases.

    Styles (Experimental)

    We are introducing a new experimental foundation API for styling. The Style API is a new paradigm for customizing visual elements of components, which has traditionally been performed with modifiers. It is designed to unlock deeper, easier customization by exposing a standard set of styleable properties with simple state-based styling and animated transitions. With this new API, we’re already seeing promising performance benefits. We plan to adopt Styles in Material components once the Style API stabilizes.

    A basic example of overriding a pressed state style background:

    @Composable
    fun LoginButton(modifier: Modifier = Modifier) {
        Button(
            onClick = {
                // Login logic
            },
            modifier = modifier,
            style = {
                background(
                    Brush.linearGradient(
                        listOf(lightPurple, lightBlue)
                    )
                )
                width(75.dp)
                height(50.dp)
                textAlign(TextAlign.Center)
                externalPadding(16.dp)
    
                pressed {
                    background(
                        Brush.linearGradient(
                            listOf(Color.Magenta, Color.Red)
                        )
                    )
                }
            }
        ){
            Text(
                text = "Login",
            )
        }
    }

    MediaQuery (Experimental)

    The new mediaQuery API provides a declarative and performant way to adapt your UI to its environment. It abstracts complex information retrieval into simple conditions within a UiMediaScope, ensuring recomposition only happens when needed.

    With support for a wide range of environmental signals—from device capabilities like keyboard types and pointer precision, to contextual states like window size and posture—you can build deeply responsive experiences. Performance is baked in with derivedMediaQuery to handle high-frequency updates, while the ability to override scopes makes testing and previews seamless across hardware configurations.

    Previously, to get access to certain device properties — like if a device was in tabletop mode — you’d need to write a lot of boilerplate to do so:

    @Composable
    fun isTabletopPosture(
        context: Context = LocalContext.current
    ): Boolean {
        val windowLayoutInfo by
            WindowInfoTracker
                .getOrCreate(context)
                .windowLayoutInfo(context)
                .collectAsStateWithLifecycle(null)
    
        return windowLayoutInfo.displayFeatures.any { displayFeature ->
            displayFeature is FoldingFeature &&
                displayFeature.state == FoldingFeature.State.HALF_OPENED &&
                displayFeature.orientation == FoldingFeature.Orientation.HORIZONTAL
        }
    }
    
    @Composable
    fun VideoPlayer() {
        if(isTabletopPosture()) {
            TabletopLayout()
        } else {
            FlatLayout()
        }
    }

    Now, with UIMediaQuery, you can add the mediaQuery syntax to query device properties, such as if a device is in tabletop mode:

    @OptIn(ExperimentalMediaQueryApi::class)
    @Composable
    fun VideoPlayer() {
        if (mediaQuery { windowPosture == UiMediaScope.Posture.Tabletop }) {
            TabletopLayout()
        } else {
            FlatLayout()
        }
    }

    Check out the documentation and file any bugs here.

    Grid (Experimental)

    Grid is a powerful new API for building complex, two-dimensional layouts in Jetpack Compose. While Row and Column are great for linear designs, Grid gives you the structural control needed for screen-level architecture and intricate components without the overhead of a scrollable list.

    Grid allows you to define your layout using tracks, gaps, and cells, offering familiar sizing options like Dp, percentages, intrinsic content sizes, and flexible “Fr” units.

    @OptIn(ExperimentalGridApi::class)

    @Composable

    fun GridExample() {

        Grid(

            config = {

                repeat(4) { column(0.25f) }

                repeat(2) { row(0.5f) }

                gap(16.dp)

            }

        ) {

            Card1(modifier = Modifier.gridItem(rowSpan = 2)

            Card2(modifier = Modifier.gridItem(colmnSpan = 3)

            Card3(modifier = Modifier.gridItem(columnSpan = 2)

            Card4()

        }

    }

    You can place items automatically or explicitly span them across multiple rows and columns for precision. Best of all, it’s highly adaptive—you can dynamically reconfigure your grid tracks and spans to respond to device states like tabletop mode or orientation changes, ensuring your UI looks great across form factors.

    Check out the documentation and file any bugs here.

    FlexBox (Experimental)

    FlexBox is a layout container designed for high performance, adaptive UIs. It manages item sizing and space distribution based on available container dimensions. It handles complex tasks like wrapping (wrap) and multi-axis alignment of items (justifyContent, alignItems, alignContent). It allows items to grow (grow) or shrink (shrink) to fill the container.

    @OptIn(ExperimentalFlexBoxApi::class)
    fun FlexBoxWrapping(){
        FlexBox(
            config = {
                wrap(FlexWrap.Wrap)
                gap(8.dp)
            }
        ) {
            RedRoundedBox()
            BlueRoundedBox()
            GreenRoundedBox(modifier = Modifier.width(350.dp).flex { grow(1.0f) })
            OrangeRoundedBox(modifier = Modifier.width(200.dp).flex { grow(0.7f) })
            PinkRoundedBox(modifier = Modifier.width(200.dp).flex { grow(0.3f) })
        }
    }

    Check out the documentation and file any bugs here.

    New SlotTable implementation (Experimental)

    We’ve introduced a new implementation of the SlotTable, which is disabled by default in this release. SlotTable is the internal data structure that the Compose runtime uses to track the state of your composition hierarchy, track invalidations/recompositions, store remembered values, and track all metadata of the composition at runtime. This new implementation is designed to improve performance, primarily around random edits.

    To try the new SlotTable, enable ComposeRuntimeFlags.isLinkBufferComposerEnabled.

    Start coding today!

    With so many exciting new APIs in Jetpack Compose, and many more coming up, it’s never been a better time to migrate to Jetpack Compose. As always, we value your feedback and feature requests (especially on @Experimental features that are still baking) — please file them here. Happy composing!



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email

    Related Posts

    This pool-cleaning robot can climb out of pools, and you can get it for $1,000 off

    April 23, 2026

    John Ternus is an Apple TV fan, but wants to make it ‘more competitive’: report

    April 22, 2026

    A perfect ten: Galaxy S25 users get a One UI 8.5 Beta 10 that’s hopefully its last

    April 21, 2026

    Lighter Huawei Watch Buds 2 unveiled, diamond-studded Huawei Watch Ultimate brings the bling

    April 20, 2026

    Cracks are starting to form on fusion energy’s funding boom

    April 19, 2026

    Enhanced ‘Audio Eraser’ With the Galaxy S26 Series – Samsung Global Newsroom

    April 18, 2026
    Top Posts

    Understanding U-Net Architecture in Deep Learning

    November 25, 202531 Views

    Hard-braking events as indicators of road segment crash risk

    January 14, 202626 Views

    Redefining AI efficiency with extreme compression

    March 25, 202625 Views
    Don't Miss

    Another spyware maker caught distributing fake Android snooping apps

    April 24, 2026

    Yet another government spyware maker has been caught after its customers used fake Android apps…

    Deutsche Telekom considers merging with T-Mobile

    April 24, 2026

    Malaysia deepens national AI partnership with Microsoft, expanding whole-of-nation skilling across educators, enterprises, and communities

    April 24, 2026

    Microsoft Must Face £2.1B UK Cloud Licensing Lawsuit

    April 24, 2026
    Stay In Touch
    • Facebook
    • Instagram
    About Us

    At GeekFence, we are a team of tech-enthusiasts, industry watchers and content creators who believe that technology isn’t just about gadgets—it’s about how innovation transforms our lives, work and society. We’ve come together to build a place where readers, thinkers and industry insiders can converge to explore what’s next in tech.

    Our Picks

    Another spyware maker caught distributing fake Android snooping apps

    April 24, 2026

    Deutsche Telekom considers merging with T-Mobile

    April 24, 2026

    Subscribe to Updates

    Please enable JavaScript in your browser to complete this form.
    Loading
    • About Us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • Terms and Conditions
    © 2026 Geekfence.All Rigt Reserved.

    Type above and press Enter to search. Press Esc to cancel.