I want to create selectable text using Jetpack Compose. Sample code is as following
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
TextSelectionTheme {
// A surface container using the 'background' color from the theme
Surface(color = MaterialTheme.colors.background) {
Greeting("Android")
}
}
}
}
}
@Composable
fun Greeting(name: String) {
SelectionContainer(){
Text(text = "Hello This is a sample text for testing out selections $name!")
}
}
The problem is, it is showing only copy button near selection.
but when I use normal text view with isSelectable = true
, it shows Android text selection toolbar,
Need help to understand how to show such toolbar in Jetpack compose when some text is selected and also is it possible to show More custom options ?