Jetpack Compose - SelectionContainer - how to add missing functionality?
16:28 30 Jan 2022

I'm trying to replicate some View-based selected text behavior with Jetpack Compose. In both of these cases, I've long-tapped on the middle of the URL.

View based:


view-based-screenshot

Compose:

    SelectionContainer {
        Text(...)
    }

compose-based-screenshot

As you can see in the screenshots, there are a few missing options in the Compose layout. Is there a way to add this? Yes, I know I can use AndroidView but is there a more composey way to do it? Here's what's in the View layout, but lacking from the Compose layout:

  • "Share"
  • "Select All"
  • "Open" when a url is selected
  • (AI-based?) auto selection of URLs. Tap and hold anywhere on the URL automatically selects the URL part.

Edit: I'm not asking for a custom toolbar, I'm asking for the one Google provides in TextView.

android-view android-jetpack-compose