我正在使用jetpack compose(1.0.0-beta09)在我的项目上实现一个屏幕,但是我在一个需要始终可见的页脚的屏幕上遇到了一个问题,即使打开了键盘,我知道我们有android上的'adjustResize'在正常活动中解决了这个问题(我有很多带有这种页脚类型的屏幕并且它正在工作),但是如果我将adjustResize放在清单或活动的onCreate方法上键盘继续隐藏页脚:
那是我没有打开键盘的屏幕,只是为了弄清楚我在说什么
这就是打开键盘的屏幕
清单活动标签,我正在尝试在键盘已经打开并且页脚在他上方可见的情况下打开屏幕:
<activity
android:name=".presentation.creation.billing.NewBookingBillingActivity"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/AppThemeBase.Compose"
android:windowSoftInputMode="stateVisible|adjustResize"/>
创建方法:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
injectFeature()
initView()
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
setContent {
BuildScreen()
}
}
我知道在清单和 onCreate 上使用 setSoftInputMode 是多余的,但我正在尝试任何东西。
-
我的屏幕组成范围:
Column(fillMaxSize){
- AppBar
- Box(fillMaxSize){
//lazycolumn used to enable scroll with bottom padding to prevent last item to be hided below the footer
- LazyColumn(fillMaxSize | contentPadding) {
//TextFields of the screen
}
//footer
- Box(fillMaxWidth | height 53 | align.centerBottom){
//footer content
}
}
}