2

I've this big problem: when i click on edittext and the keyboard is up, the keyboard covers the button. I've searched the solution around the web but adjustresize, adjustpan don't work. I've tried also to use getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); but doesn't work.

<?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/sfondo3"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:isScrollContainer="true"
     >

<RelativeLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal" >

    <TextView
        android:id="@+id/nickname"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="200dp"
        android:text="Inserisci un Nickname:"
        android:textSize="20dp" />

    <Button
        android:id="@+id/b1"
        android:layout_width="120dp"
        android:layout_height="50dp"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="350dp"
        android:text="Accedi" />



    <EditText
        android:id="@+id/editText1"
        android:layout_width="200dp"
        android:layout_height="50dp"
         android:layout_marginTop="250dp"
          android:windowSoftInputMode="adjustPan"
        android:layout_centerHorizontal="true"
        android:ems="10" />

    <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="20dp"
        android:src="@drawable/logox" />



</RelativeLayout>
</ScrollView>

1 Answers1

1

You can try to declare windowSoftInputMode in the AndroidManifest.xml file as following. It fill force activity to adjust its size when keyboard is shown.

<activity android:name="YourActivityName"
            android:windowSoftInputMode="adjustResize">

If this doesn't help, you might want to implement a more complex solution suggested in this thread.

Community
  • 1
  • 1
sergej shafarenka
  • 20,071
  • 7
  • 67
  • 86