android - Scroll a Scroll View which contains Edit Text -


my scroll view contains linear layout further contains of edit text fields. when click on edit text field @ bottom 1 soft keyboard appears, problem covers edit textfield. activity declared in android manifest file:

<activity android:name="me.example.scrollview.loginactivity" android:label="@string/title_activity_login" android:theme="@android:style/theme.black.notitlebar" android:windowsoftinputmode="statehidden|adjustresize|adjustpan" > </activity>

and here layout.xml file activity.

<relativelayout 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="@android:color/darker_gray" tools:context=".loginactivity" >  <scrollview     android:id="@+id/login_sv_login_container"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:isscrollcontainer="true"     android:background="@android:color/transparent" >      <linearlayout         android:id="@+id/login_ll_container"         android:layout_width="250dp"         android:layout_height="wrap_content"         android:layout_margintop="230dp"         android:layout_gravity="center_horizontal"         android:background="@android:color/transparent"         android:orientation="vertical" >          <edittext             android:id="@+id/txt_username"             android:layout_width="match_parent"             android:layout_height="40dp"             android:layout_gravity="center_horizontal"             android:background="@drawable/rounded_edittext"             android:ems="10"             android:inputtype="textemailaddress"             android:maxlines="1"             android:singleline="true" >              <requestfocus />         </edittext>          <edittext             android:id="@+id/txt_phone"             android:layout_width="match_parent"             android:layout_height="40dp"             android:layout_margintop="10dp"             android:background="@drawable/rounded_edittext"             android:ems="10"             android:inputtype="phone"             android:maxlines="1"             android:singleline="true" />          <edittext             android:id="@+id/txt_password"             android:layout_width="match_parent"             android:layout_height="40dp"             android:layout_margintop="10dp"             android:background="@drawable/rounded_edittext"             android:ems="10"             android:inputtype="textpassword"             android:maxlines="1"             android:singleline="true" />          <button             android:id="@+id/btn_login"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_gravity="right"             android:layout_margintop="10dp"             android:background="@drawable/ic_login"             android:text="" />     </linearlayout> </scrollview> 

now please me new android programming. unable fix issue , can't find way scroll scroll view without resizing main window.i want scroll view make scrolling when soft keyboard appears.thanx in advance.

enter image description here

both pointed out solutions can work. there might still problem if edittext @ bottom of listview still covered onscreen keyboard. not sure if scrollview can scrolled point there no more content.

what i've seen might use 2 contradicting flags in manifest:

android:windowsoftinputmode="statehidden|adjustresize|adjustpan" > </activity> 

adjustresize , adjustpan can imho not combined. try how looks adjustresize. should avoid keyboard covers of view.


Comments