fix input field way too high — use adjustResize instead of imePadding
imePadding() on Compose Box/Column with overlapping children (BottomCenter-aligned dock over fillMaxSize LazyColumn) caused the input to float to the top of the screen. The Compose inset system doesn't work well with this overlay layout pattern. Fix: remove all imePadding() usage, set windowSoftInputMode= adjustResize in AndroidManifest. Android resizes the window itself when the keyboard opens — the entire layout naturally reflows, dock stays at the bottom, chat area shrinks. This is the standard approach for chat apps with edge-to-edge.
This commit is contained in:
parent
e697dd7e76
commit
420bcd7cb6
2 changed files with 2 additions and 2 deletions
|
|
@ -21,6 +21,7 @@
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
android:windowSoftInputMode="adjustResize"
|
||||||
android:theme="@style/Theme.Kaizen">
|
android:theme="@style/Theme.Kaizen">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
import androidx.compose.foundation.layout.WindowInsets
|
||||||
import androidx.compose.foundation.layout.imePadding
|
|
||||||
import androidx.compose.foundation.layout.isImeVisible
|
import androidx.compose.foundation.layout.isImeVisible
|
||||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
|
@ -538,7 +537,7 @@ fun ChatScreen(
|
||||||
gesturesEnabled = true // Allows swiping from the screen's left edge to open the drawer
|
gesturesEnabled = true // Allows swiping from the screen's left edge to open the drawer
|
||||||
) {
|
) {
|
||||||
MeshBackground {
|
MeshBackground {
|
||||||
Box(Modifier.fillMaxSize().imePadding(), contentAlignment = Alignment.Center) {
|
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||||
// 1. Scrollable Chat Content
|
// 1. Scrollable Chat Content
|
||||||
// Stretches to the full screen, allowing bubbles to scroll cleanly behind the floating bottom dock.
|
// Stretches to the full screen, allowing bubbles to scroll cleanly behind the floating bottom dock.
|
||||||
// Centered layout with responsive width capping on tablets.
|
// Centered layout with responsive width capping on tablets.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue