android - 片段视图下方的键盘
问题描述
这就是我想要
的我正在使用BottomsheetFragment
我想要的是键盘应该在视图下方。但在我的情况下,键盘与片段视图重叠。
这是我的 xml 文件在这里检查我的代码
and i am getting this output
解决方案
我已经创建了一个示例应用程序并在您提供的底页 xml 上进行了测试。通过添加
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"
清单文件确实有效。
所以清单文件如下所示。
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
或者,您也可以在 Activity 类的 onCreate 中动态设置此属性,如下所示
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
我在示例应用程序上尝试了两种方式
推荐阅读
- r - R:保存多个 igraph 图
- wpf - 为什么我的 Style.trigger 事件不适用于我的 WPF Datagrid?
- java - ResultSet 列值已修改:有时将随机字符串添加到一个结果集列值
- python - 如何将列中的结果拆分为 python 中的两个单独的列?
- c - 如何将值添加到C中二维数组中的特定位置
- swiftui - 如何在 iPad 上显示与 iPhone 相同的视图而不是拆分视图?
- entity-framework - EF核心多对多关系违反主键约束实体
- python - 从文件读取连接 Bags 时出现意外行为
- sql - 如何在 PL/SQL 中将每日快照转换为有效日期范围?
- c - 为什么可以在 scanf 的转换说明符中嵌入空字符?