14

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:

<TextView ... android:textIsSelectable="true" />

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.

dgmltn
  • 3,833
  • 3
  • 25
  • 27
  • 1
    Does this answer your question? [Floating toolbar for text selection Jetpack Compose](https://stackoverflow.com/questions/68956792/floating-toolbar-for-text-selection-jetpack-compose) – Johann Jan 31 '22 at 07:30
  • Guess that's not possible at the moment...there is a selection state that `SelectionContainer` uses internally that would allow to pre-select stuff manually.....but it's not exposed. – crysxd Jul 04 '22 at 08:19
  • 2
    I think you should create https://issuetracker.google.com/issues/new?component=612128&template=1253476 a feature request on compose issue tracker, right now such customisation doesn't seems to be supported. – Nikhil Dupally Sep 20 '22 at 12:24
  • Ugh, I can't believe it's still not working! – normidar Aug 23 '23 at 09:28

0 Answers0