当前位置: 首页 > news >正文

android compose 对话框AlertDialog中软键盘弹出后TextField多个挤压变形

让内容可滑动

//关键点 val scrollState = rememberScrollState() AlertDialog( containerColor = DialogBg, modifier = Modifier .widthIn(min = 400.dp) .fillMaxWidth(0.3f) //关键点 .windowInsetsPadding(WindowInsets.safeDrawing), onDismissRequest = { }, properties = DialogProperties( dismissOnBackPress = true, dismissOnClickOutside = true, // usePlatformDefaultWidth = false, // 禁用平台默认宽度,避免尺寸波动 decorFitsSystemWindows = false // 禁用系统窗口适配,减少布局冲突 ), title = { Row(verticalAlignment = Alignment.CenterVertically) { Image( painter = painterResource(R.drawable.warning), contentDescription = "菜单", modifier = Modifier.size(20.dp) ) Spacer(modifier = Modifier.width(8.dp)) Text(text = title, fontSize = 22.sp) } }, text = { //关键点 Column(modifier = Modifier.verticalScroll(scrollState)) { if (!firstPrompt.isBlank()) { CustomOutlinedTextField( label = { Text(firstStrDes) }, value = firstPrompt, singleLine = true, readOnly = true, enabled = false, onValueChange = { }, keyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Text, imeAction = ImeAction.Done ), modifier = Modifier .height(55.dp) .fillMaxWidth(0.95f), contentPadding = PaddingValues(start = 10.dp, end = 2.dp), colors = OutlinedTextFieldDefaults.customColors(), ) Spacer(modifier = Modifier.height(8.dp)) } CustomExposedDropdownMenu( modifier = Modifier .height(55.dp) .fillMaxWidth(0.95f), tempShow, labelStr, selectedOptionText = selectedOptionText ) { result -> selectedOptionTextId.value = result.getShowId() } Spacer(modifier = Modifier.height(8.dp)) CustomOutlinedTextField( label = { Text(textInputDes) }, value = editString.value, singleLine = true, onValueChange = { editString.value = it }, keyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Number, imeAction = ImeAction.Done ), modifier = Modifier .height(55.dp) .fillMaxWidth(0.95f), contentPadding = PaddingValues(start = 10.dp, end = 2.dp), colors = OutlinedTextFieldDefaults.customColors(), ) } }, confirmButton = { TextButton(onClick = { if (editString.value.isEmpty()) { ToastUtil.showToast("请输入${textInputValue}") return@TextButton } // 根据选中的ID找到对应的T对象 val selectedItem = showSelectList.find { it.getShowId() == selectedOptionTextId.value } if (null == selectedItem) { ToastUtil.showToast("请选择$labelStr") return@TextButton } okClick?.invoke(selectedItem, editString.value) dialogState.value = false }) { Text(text = "确认") } }, dismissButton = { TextButton(onClick = { dialogState.value = false }) { Text(text = "取消") } }, )
http://www.jsqmd.com/news/178696/

相关文章:

  • 【高中数学/排列组合】由字母AB构成的一个6位的序列,含有连续子序列ABA的序列有多少个?
  • YOLOFuse动物园游客行为规范:投喂与拍打玻璃识别
  • YOLOFuse危化品仓库温控监测:异常发热及时告警
  • 新手必看:ECU实现UDS 28服务的基础原理
  • React Native新手必读:模拟器与真机调试全解析
  • 如何通过UDS诊断定位并清除历史DTC
  • YOLOFuse博物馆防盗系统:夜间无人值守监控
  • YOLOFuse双摄像头数据采集建议:同步拍摄注意事项
  • YOLOFuse加油站安全监管:烟火风险实时探测
  • YOLOFuse如何导出ONNX模型?后续部署转换教程
  • Proteus安装过程中的权限问题解决:教师部署建议
  • javaSE接口随笔
  • UVC驱动开发实战:多摄像头并发处理方案设计
  • YOLOFuse野生动物保护区反盗猎系统:隐蔽式布控
  • 手把手教你完成LED显示屏同步模式设置
  • YOLOFuse养老院跌倒检测方案:隐私保护型红外识别
  • YOLOFuse小区垃圾分类督导:错误投放行为抓拍
  • [特殊字符]_可扩展性架构设计:从单体到微服务的性能演进[20260101170150]
  • haxm is not installed?超详细版解决方案步骤说明
  • YOLOFuse远程医疗会诊辅助:患者体征初步判断
  • [特殊字符]_内存管理深度解析:如何避免GC导致的性能陷阱[20260101170655]
  • 数据分类与汇总:使用Pandas分析图像像素值
  • YOLOFuse实验室安全管理:危险操作自动截停
  • Multisim仿真电路图实例对SR锁存器工作原理的图解说明
  • YOLOFuse边境巡逻应用:非法越境实时警报系统
  • YOLOFuse茶叶加工厂卫生检查:异物混入实时拦截
  • YOLOFuse洪水淹没范围评估:无人机红外航测
  • YOLOFuse港口夜间作业监控解决方案
  • YOLOFuse牛奶消毒过程监控:包装完整性检验
  • 核心要点:选择整流二极管时的关键参数分析