Is there any way to prevent cut, copy, paste in TextField in Android Jetpack Compose?
I tried Modifier's pointerInput but it is not working.
Modifier.pointerInput(Unit) {
detectTapGestures(onLongPress = {
Toast.makeText(context, "long pressed", Toast.LENGTH_SHORT).show()
})
}
Is there any way to achieve this in Compose?
Related
My Application is fully Composable and I do not want to use View,
my objective is to show a specific Composable at the bottom of the screen, and if the keyboard appears than on top of the keyboard, is it possible?
Thanks!
I was trying to use
activity?.let {
WindowCompat.setDecorFitsSystemWindows(it.window, false)
}
ProvideWindowInsets {
content{}
}
apparently it is deprecated, here is the solution:
https://google.github.io/accompanist/insets/
modifier = Modifier
.fillMaxSize().imePadding().systemBarsPadding()
Am I missing something, but why Scaffold's TopAppBar moves out of the screen when keyboard appears?
I have a simple layout:
setContent {
MyTheme {
Scaffold(topBar = { MyTopAppBar() }) {
ScaffoldContent(it)
}
}
}
Where ScaffoldContent is just a Column with a TextField.
When I press a TextField, keyboard opens and moves everything up . How can I make the bar stick at the top?
Tried:
android:windowSoftInputMode="adjustResize" or "adjustPan"
Instead of Scaffold use a Column and add elements there, but moves anyway
Expected:
TopAppBar to be at the top all the time, like in our Views system
I am using Android Compose ExposedDropdownMenu, but its text can be selected with a long press.
Using DisableSelection section does NOT help at all:
DisableSelection {
ExposedDropDownmenu(){...}
}
How to disable the text selection for this case or deselect any selection detected? Thanks
I think the problem here is that ExposedDropdownMenu creates a new Popup, which is a new window, try placing the DisableSelection composable inside the content of the Dropdown
Can i make animation of crossing my Text from first letter to the last one using Jetpack Compose? Something like :
val strikethrough by animateCrossingText(
if (isDone) strikethrough text else usual text
)
i'm trying to replace default back button icon on toolbar like this:
toolbar.navigationIcon = R.drawable.lalala
it's fine, and it's working. But, when i'm trying to click back button, for a half second i can see default icon instead of mine. What i can do wrong ?
I'm using fragments and JetPack navigation.
Since you are using the Navigation Components, the expected behavior is the Up button displayed when you are on a non-root destination.
You can change it using the addOnDestinationChangedListener after your setup method.
Something like:
navController.addOnDestinationChangedListener { _, destination, _ ->
if(destination.id == R.id.xxxx) {
toolbar.setNavigationIcon(R.drawable.xxxx)
} else {
//
}
}