【发布时间】:2016-06-07 12:13:42
【问题描述】:
我有一个带有滚动视图的登录屏幕,我正在将布局设置为全屏
if (VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(Color.TRANSPARENT);
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
问题是即使我有滚动视图,当键盘弹出时我也无法滚动。这是我的布局
<ScrollView
android:id="@+id/scrollView"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ooru"
android:fitsSystemWindows="false"
tools:context=".android.LoginActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/branding_login"
android:layout_width="170dp"
android:layout_height="35dp"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="55dp"
android:scaleType="centerInside"
android:src="@drawable/branding"/>
<ImageView
android:id="@+id/logged_in_icon"
android:layout_width="54dp"
android:layout_height="54dp"
android:layout_below="@id/branding_login"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="42dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_fan_icon"/>
.... //More views
</RelativeLayout>
</ScrollView>
我尝试搜索该问题,有人建议添加 android:windowSoftInputMode="adjustResize",但它对我不起作用。
PS:此活动的父主题是 Theme.AppCompat.Light.NoActionBar
【问题讨论】:
-
将 "android:fillViewport="true" " 添加到您的滚动视图并将相对布局高度设置为 match_parent
-
设置 fillViewPort 和添加 match_parent 不起作用,@SunilSharma 我已经尝试过这样做,如该答案所示
-
如果棒棒糖上面有问题,那么试试
android:fitsSystemWindows="true" -
也这样做了,实际上我尝试删除 View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) 标志,然后滚动工作正常,但它会显示状态栏,这不是我想要的
标签: android android-scrollview