我有一个NestedScrollView
在我的活动与大约7-8编辑文本,我需要他们向上移动时,键盘显示。我这么做了,但不起作用
android:windowSoftInputMode="adjustPan|adjustResize"
activity.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_login"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:focusableInTouchMode="true"
tools:context="com.amir_p.cafino.LoginActivity">
<ImageView
android:id="@+id/back_img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grayTransparent" />
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:id="@+id/signup_layout"
android:fillViewport="true"
android:layout_height="wrap_content"
android:visibility="gone">
<LinearLayout
android:id="@+id/register_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="16dp">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:hint="نام و نام خانوادگی"
android:textColorHint="@color/white">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:backgroundTint="@color/white" />
</android.support.design.widget.TextInputLayout>
[...]
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
发布于 2017-03-10 11:21:04
尝试为滚动视图添加android:fillViewport="true"
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:visibility="visible">
在清单中添加:
android:windowSoftInputMode="stateVisible|adjustResize"
您可以提前关闭填充屏幕模式:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
全屏模式不调整大小.
或者你可以使用不同的主题:android:theme="@android:style/Theme.Black.NoTitleBar
https://stackoverflow.com/questions/42726040
复制