Problem : Bottom app bar in scaffold jumping up ab...
# compose
p
Problem : Bottom app bar in scaffold jumping up above keyboard even when its not required I have two text fields in below screen, when text input starts in the top filter screen, then bottom app bar which also have a input field, jumps with the keyboard, this hides part of the list in background and is undesirable. Any idea how to prevent it.
c
not sure if its the same issue, but @Sam recently had some edit text issues with the keyboard I think. maybe you can find that thread above that he started.
p
@Colton Idle about the keyboard not coming up? I am also getting that bug randomly. did the focusRequester fix..
@Colton Idle how ever for my case I tried to release focus from the input field in bottom app bar when text input starts in upper text field, but it doesn't work..
z
Can you share a sample code?
p
z
@Prashant Priyadarshi actually I was asking for your version where the bottomnav goes up undesirably.
p
Hi @zoha131, This occurs when I use android:windowSoftInputMode="adjustResize" in my android manifest file,
Copy code
<activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:windowSoftInputMode="adjustResize"
            android:theme="@style/Theme.LearnCompose.NoActionBar">
below is the sample code and I have also attached the screen shot
Copy code
@Composable
    fun scaffoldWithTwoInputs(){
        val topText = remember { mutableStateOf("") }
        val bottomText = remember { mutableStateOf("") }
        val modifier = Modifier.fillMaxWidth()
    Scaffold(modifier = Modifier.fillMaxSize(),
            topBar = {
                OutlinedTextField(value = topText.value,
                        onValueChange = {s-> topText.value = s }, modifier = modifier)
            },
            bodyContent = {
                Column(modifier = modifier.padding(50.dp), verticalArrangement = Arrangement.Center) {
                    Text(text = topText.value, style = typography.h6, color = Color.Black)
                    Text(text = bottomText.value, style = typography.h6, color = Color.Black)
                }
            },
            bottomBar = {
                OutlinedTextField(value = bottomText.value, onValueChange = {s-> bottomText.value = s },
                        modifier = modifier)
            }
    )
}
@zoha131 I used adjustResize because without using it, softkeyboard covers parts of input text field of bottomAppBar as in below pic Any suggestions ...
z
I am not clear with your use-case. You want to hide the inputfield of the bottom when it is not in focus? You are using InputField inside the
bottomBar
. But from you first message I thought You want to hide the bottom nav when keyboard is visible in the screen. Can you please clear what do want to achieve? You can use this library to detect if keyboard is visible or not.