1

I think i tried all the solutions on internet but at my login screen login button is still under the keyboard. I want to scroll to the bottom automatically when keyboard appears. Here is my xml codes

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView01"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none" >


<RelativeLayout 
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:theme="@android:style/Theme.NoTitleBar"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="#13a7d8"
 >

  <ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="-120dp"
    android:src="@drawable/logo_login" />

<EditText
    android:id="@+id/editText1"
    android:layout_width="220dp"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textView1"
    android:layout_centerHorizontal="true"
    android:ems="10"
    android:inputType="textEmailAddress" />

<EditText
    android:id="@+id/editText2"
    android:layout_width="220dp"
    android:layout_height="wrap_content"
    android:layout_below="@+id/benimlabel2"
    android:layout_centerHorizontal="true"
    android:ems="10"
    android:inputType="textPassword" />

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/imageView1"
    android:layout_marginTop="-130dp"
    android:layout_alignLeft="@+id/editText1"
    android:textColor="#FFFFFF"
    android:text="@string/eposta"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/benimlabel2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/editText1"
    android:layout_alignLeft="@+id/editText2"
    android:textColor="#FFFFFF"
    android:text="@string/sifre"
    android:textAppearance="?android:attr/textAppearanceLarge" />



<Button
    android:id="@+id/button1"
    android:layout_width="220dp"
    android:layout_height="wrap_content"
    android:layout_below="@+id/editText2"
    android:layout_centerHorizontal="true"
    android:text="@string/girisyap" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/button1"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="30dp"
    android:text="Hesabın yoksa, hemen kayıt ol"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="#FFFFFF"
    android:clickable="true"
    android:onClick="kayitol" />

</RelativeLayout>
</ScrollView>

and I tried different solutions at manifest file

android:windowSoftInputMode="stateVisible|adjustPan"

other try

android:windowSoftInputMode="stateVisible"

how can i fix this?

sipdorus
  • 963
  • 1
  • 12
  • 28

1 Answers1

0

This code worked for me.

Put this in onResume() of your activity

((ScrollView) findViewById(R.id.ScrollView01)).post(new Runnable() 
{
    public void run() 
    {
        ((ScrollView) findViewById(R.id.ScrollView01)).fullScroll(View.FOCUS_DOWN);
}
});
someone
  • 427
  • 2
  • 11
  • I saw this code before but i dont know where to put this code – sipdorus Jul 12 '14 at 13:43
  • I tried like this @Override protected void onResume() { ((ScrollView) findViewById(R.id.ScrollView01)).post(new Runnable() { public void run() { ((ScrollView) findViewById(R.id.ScrollView01)).fullScroll(View.FOCUS_DOWN); } }); } but code error :( – sipdorus Jul 12 '14 at 16:49
  • ((ScrollView) findViewById(R.id.ScrollView01)) no suggestions avilable – sipdorus Jul 12 '14 at 17:37