Soft keyboard comes out through EditText

I am using Eclipse ADT to develop an Android application. When the focus falls on one of the EditText (at the bottom of the page), the keyboard closes the EditText, so when I manipulate the text, I don’t see what is being put into action. What are my options?

Index Activity Layout

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#a8e8f0" android:orientation="vertical" android:id="@+id/layout"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@drawable/welcome_background"> <include layout="@layout/top"></include> <RelativeLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:gravity="center"> <LinearLayout android:layout_width="270dp" android:orientation="vertical" android:layout_height="wrap_content" android:id="@+id/body"> <ImageView android:layout_width="wrap_content" android:src="@drawable/welcome_title" android:layout_height="wrap_content" android:id="@+id/title" style="@style/Theme.Connector.ImageElement"></ImageView> <TextView android:text="@string/welcome_text" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/txt_welcome" style="@style/Theme.Connector.FormText"></TextView> <Spinner android:layout_width="fill_parent" android:layout_height="wrap_content" style="@style/Theme.Connector.WelcomeSpinner" android:layout_weight="1" android:id="@+id/spinner_isp" /> <EditText android:layout_height="wrap_content" android:singleLine="true" style="@style/Theme.Connector.WelcomeInput" android:hint="@string/txt_user" android:layout_width="fill_parent" android:id="@+id/edit_user"></EditText> <EditText android:layout_alignParentLeft="true" android:singleLine="true" android:layout_height="wrap_content" style="@style/Theme.Connector.WelcomeInput" android:hint="@string/txt_password" android:layout_width="fill_parent" android:password="true" android:id="@+id/edit_password"/> <LinearLayout android:layout_width="fill_parent" android:orientation="horizontal" android:layout_height="fill_parent" android:id="@+id/frm_action"> <Button style="@style/Theme.Connector.Button" android:layout_height="wrap_content" android:layout_width="100dp" android:text="@string/btn_cancel" android:layout_weight="1" android:id="@+id/btn_cancel" /> <Button android:text="@string/btn_continue" android:layout_height="wrap_content" android:layout_width="100dp" style="@style/Theme.Connector.ButtonContinue" android:layout_weight="1" android:id="@+id/btn_continue"></Button> </LinearLayout> </LinearLayout> </RelativeLayout> </LinearLayout> </LinearLayout> 

AndroidManifest.xml

 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="vex.connector" android:versionCode="1" android:versionName="1.0"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/Theme.Connector"> <activity android:name=".IndexActivity" android:label="@string/app_name" android:screenOrientation="portrait" android:windowSoftInputMode="stateVisible|adjustPan"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <receiver android:name=".WiFiBroadcastReceiver"> <intent-filter> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> </intent-filter> </receiver> </application> </manifest> 

Keyboard

keyboard

+2
source share
3 answers

Wrap your outer LinerLayout in a ScrollView, e.g.

 <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" ... <!-- Your current layout here --> </ScrollView> 

This will scroll the layout to see the bottom EditText

+9
source

I had the same problem and I found the tarkeshwar approach better.

What happens if you set android: windowSoftInputMode = "adjustResize" instead of the customPan that you currently have? Also, are you using fullscreen style (android: windowFullscreen)? Only today I had a similar problem with the keyboard overlapping. Using adjustResize and getting rid of full-screen style fixed.

tarkeshwar

+1
source

If none of these answers help make sure your style doesn't set this attribute:

 <item name="android:windowTranslucentStatus">true</item> 

If so, redefine your activity style.

+1
source

Source: https://habr.com/ru/post/920402/


All Articles