The layout is not visible completely when the keyboard is popup.I have tried a lot of example.But it's not working.Any help will be appreciated.Thanks in advance.My manifest.xml file is
<activity
android:name=".activity.SignUp"
android:windowSoftInputMode="stateVisible|adjustResize"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
My layout file is
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:focusableInTouchMode="false"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:src="@drawable/userprofile" />
<EditText
android:id="@+id/editText"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginBottom="-10dp"
android:layout_marginLeft="80dp"
android:hint="USERNAME"
android:inputType="textPersonName"
/>
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText"
android:layout_marginLeft="39dp"
android:layout_marginTop="30dp"
android:src="@drawable/email" />
<EditText
android:id="@+id/editText2"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/imageView3"
android:layout_alignLeft="@+id/editText"
android:layout_alignStart="@+id/editText"
android:hint="ENTER EMAIL"
android:inputType="textEmailAddress"
/>
<ImageView
android:id="@+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView3"
android:layout_marginLeft="39dp"
android:layout_marginTop="20dp"
android:src="@drawable/passunlock" />
<EditText
android:id="@+id/editText3"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/imageView4"
android:layout_marginLeft="80dp"
android:layout_marginTop="-15dp"
android:hint="ENTER PASSWORD"
android:inputType="textPassword"
android:text="password" />
<ImageView
android:id="@+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imageView6"
android:layout_alignLeft="@+id/imageView4"
android:layout_alignStart="@+id/imageView4"
android:src="@drawable/password" />
<EditText
android:id="@+id/editText4"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_below="@+id/editText3"
android:layout_marginLeft="80dp"
android:layout_marginTop="10dp"
android:hint="RETYPE PASSWORD"
android:inputType="textPassword"
android:text="password" />
<ImageView
android:id="@+id/imageView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText4"
android:layout_centerHorizontal="true"
android:layout_marginTop="39dp"
android:src="@drawable/signup" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/imageView6"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:text="SIGN UP"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@android:color/white" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="-14dp"
android:layout_toLeftOf="@+id/imageView6"
android:layout_toStartOf="@+id/imageView6"
android:src="@drawable/username" />
Set Window SoftInput Mode property to adjustPan and adjustResize
<activity android:windowSoftInputMode="adjustPan|adjustResize"> </activity> OR
<activity android:windowSoftInputMode="adjustResize"> </activity> OR
<activity android:windowSoftInputMode="adjustPan"> </activity>
If any of above doesn't work then use this below code in onCreate()
method:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
Below link might help you
https://developer.android.com/training/keyboard-input/visibility.html
If adjustResize does not work then try adding ScrollView as a parent layout.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.