admin管理员组文章数量:1333659
I am using a dialog
composable within a NavHost
from NavGraphBuilder 2.8.4.
I have a demo project setup to pinpoint a issue within a larger project but it seems either decorFitsSystemWindows
doesn't account for the insets from the keyboard in multi-window mode or that I am missing something else. The padding adjusts correctly otherwise when not in multi-window mode. I also have android:windowSoftInputMode="adjustPan"
set in my app's manifest.
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
MyScreen()
}
}
}
@Composable
fun MyScreen() {
val navController = rememberNavController()
MyElevatedPopupSurface {
NavHost(navController = navController, startDestination = "main") {
composable(route = "main"){
Button(onClick = { navController.navigate("list-view") {
launchSingleTop = true
} }) {
Text("List of inputs")
}
}
dialog(
route = "list-view",
dialogProperties = DialogProperties(
usePlatformDefaultWidth = false,
decorFitsSystemWindows = false
)
){
Column(modifier = Modifier
.verticalScroll(state = rememberScrollState(), reverseScrolling = true)
.imePadding()
) {
for (index in 0 until 20) {
TextField(
value = "",
onValueChange = { /* Handle text input */ },
label = { Text("Input ${index + 1}") },
modifier = Modifier.fillMaxWidth()
)
}
}
}
}
}
}
@Composable
fun MyElevatedPopupSurface(
modifier: Modifier = Modifier,
content: @Composable () -> Unit
)
{
Box(
modifier = modifier.then(
Modifier
.padding(8.dp)
.clickable {}, // intercept click events
)
) {
PopupSurface(
elevation = 4.dp
) {
content()
}
}
}
本文标签:
版权声明:本文标题:android jetpack compose - The dialog composable's decorFitsSystemWindows = false doesn't adjust for the ime keyb 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742342091a2456807.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论