android - Keyboard hiding EditTexts in Fragments -


edit: need use keyboard, hides edittext, need scroll keyboard not hiding it.

i using samsung tablet.

my style:

parent="android:theme.holo.noactionbar.fullscreen" 

the edittext fields in scrollable view, so:

the fragment layout:

<framelayout xmlns:android="http://schemas.android.com/apk/res/android"          android:layout_height="match_parent"          android:layout_width="match_parent"          android:paddingbottom="@dimen/activity_vertical_margin"          android:paddingleft="@dimen/activity_horizontal_margin"          android:paddingright="@dimen/activity_horizontal_margin"          android:paddingtop="@dimen/activity_vertical_margin">  <scrollview     android:layout_height="wrap_content"     android:layout_width="match_parent">      <linearlayout         android:layout_height="match_parent"         android:layout_marginbottom="20dp"         android:layout_width="match_parent"         android:orientation="vertical">          <textview             android:layout_height="wrap_content"             android:layout_margintop="20dp"             android:layout_width="wrap_content"             android:text="@string/depot_code"/>          <edittext             android:hint="@string/enter_depot_code"             android:id="@+id/etlocationid"             android:imeoptions="actionnext"             android:inputtype="number"             android:layout_height="wrap_content"             android:layout_margintop="20dp"             android:layout_width="wrap_content"             android:lines="1"             android:maxlength="12"             android:singleline="true">              <requestfocus/>         </edittext>          <textview             android:layout_height="wrap_content"             android:layout_margintop="20dp"             android:layout_width="wrap_content"             android:text="@string/name"/>          <edittext             android:hint="@string/enter_name"             android:id="@+id/etname"             android:imeoptions="actionnext"             android:inputtype="textpersonname"             android:layout_height="wrap_content"             android:layout_margintop="20dp"             android:layout_width="wrap_content"             android:lines="1"             android:maxlength="24"             android:singleline="true"/>          <textview             android:layout_height="wrap_content"             android:layout_margintop="20dp"             android:layout_width="wrap_content"             android:text="@string/street"/>          <edittext             android:hint="@string/enter_street"             android:id="@+id/etstreet"             android:imeoptions="actionnext"             android:inputtype="textpostaladdress"             android:layout_height="wrap_content"             android:layout_margintop="20dp"             android:layout_width="wrap_content"             android:lines="1"             android:maxlength="24"             android:singleline="true"/>          <textview             android:layout_height="wrap_content"             android:layout_margintop="20dp"             android:layout_width="wrap_content"             android:text="@string/suburb"/>          <edittext             android:hint="@string/enter_suburb"             android:id="@+id/etsuburb"             android:layout_height="wrap_content"             android:layout_margintop="20dp"             android:layout_width="wrap_content"             android:lines="1"             android:maxlength="24"             android:singleline="true"/>          <textview             android:layout_height="wrap_content"             android:layout_margintop="20dp"             android:layout_width="wrap_content"             android:text="@string/state"/>          <spinner             android:focusable="true"             android:focusableintouchmode="true"             android:id="@+id/spinner"             android:imeoptions="actionnext"             android:layout_height="wrap_content"             android:layout_margintop="20dp"             android:layout_width="fill_parent"             android:spinnermode="dropdown"/>          <textview             android:layout_height="wrap_content"             android:layout_margintop="20dp"             android:layout_width="wrap_content"             android:text="@string/phone"/>          <edittext             android:hint="@string/enter_phone"             android:id="@+id/etphone"             android:imeoptions="actiondone"             android:inputtype="phone"             android:layout_height="wrap_content"             android:layout_margintop="20dp"             android:layout_width="wrap_content"             android:lines="1"             android:maxlength="12"             android:singleline="true"/>          <button             android:id="@+id/btnadd"             android:layout_gravity="center"             android:layout_height="wrap_content"             android:layout_margintop="20dp"             android:layout_width="wrap_content"             android:text="@string/add"/>     </linearlayout> </scrollview> </framelayout> 

the activity layout:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"           android:id="@+id/tech_controller"           android:layout_height="match_parent"           android:layout_width="match_parent"           android:orientation="vertical"           android:paddingbottom="@dimen/activity_vertical_margin"           android:paddingleft="@dimen/activity_horizontal_margin"           android:paddingright="@dimen/activity_horizontal_margin"           android:paddingtop="@dimen/activity_vertical_margin">  < .../ layouts. ../>  <framelayout     android:id="@+id/second"     android:layout_height="match_parent"     android:layout_width="fill_parent"/> </linearlayout> 

similar questions have been asked, have not found answer works.

i have project uses many fragments attached 1 activity. in manifest activity have:

android:windowsoftinputmode="statehidden" 

some of fragments require user input.

in fragment layout use:

each fragment nested follows:

<framelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_height="match_parent"     android:layout_width="match_parent" .../>  <scrollview     android:layout_height="match_parent"     android:layout_width="match_parent">      <linearlayout         android:layout_height="match_parent"         android:layout_width="match_parent"         android:orientation="vertical">          <edittext             android:imeoptions="actionnext"             or             android:imeoptions="actiondone" .../> 

this works well. except keyboard hides edittexts positioned lower on page.

enter image description here

i have read on , over:

http://developer.android.com/reference/android/widget/textview.html#attr_android:imeoptions

tried these suggestions, keyboard visible when activity called, don't want. not work. maybe because fragment?

softkeyboard hiding edittext

android keyboard hides edittext

i have been trying work out dynamic solution. appreciated.

edit: use on tablets , there 1 keyboard option, language changes.


edit: solution

i have solved installing soft keyboard. https://code.google.com/p/softkeyboard/wiki/howto

try call inputmethodmanager.hidesoftinputfromwindow() during fragment's onactivitycreated() function mentioned in so answer?

@override public void onactivitycreated(@nullable bundle savedinstancestate) {     super.onactivitycreated(savedinstancestate);     apputil.hidekeyboard(getactivity(), getview()); } 

where hidekeyboard() looks this

public static void hidekeyboard(activity activity, view viewtohide) {     inputmethodmanager imm = (inputmethodmanager) activity             .getsystemservice(context.input_method_service);     imm.hidesoftinputfromwindow(viewtohide.getwindowtoken(), 0); } 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -