0

My code is as shown below:

activity.xml

    <?xml version="1.0" encoding="utf-8"?>
   <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="22dp"
    >

    <!--<ScrollView-->
        <!--android:layout_width="match_parent"-->
        <!--android:layout_height="match_parent"-->
        <!--android:fillViewport="true">-->

        <RelativeLayout
            android:fitsSystemWindows="true"
            android:layout_centerInParent="true"
            android:layout_width="match_parent"
            android:layout_height="350dp">

            <TextView
                android:id="@+id/m"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="20dp"
                android:text="SellTm"
                android:textColor="@color/colorPrimaryDark"
                android:textSize="30sp" />

            <TextView
                android:id="@+id/partener"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/m"
                android:layout_centerHorizontal="true"
                android:text="Partner"
                android:textColor="@color/colorPrimaryDark"
                android:textSize="30sp" />

            <TextView
                android:id="@+id/usernameLabel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/partener"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:layout_marginTop="40dp"
                android:text="@string/text_user_name"
                android:textColor="@color/colorConifer"
                android:textSize="18sp" />

            <EditText
                android:id="@+id/userNameInput"
                android:layout_width="match_parent"
                android:layout_height="60dp"
                android:layout_below="@+id/usernameLabel"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:layout_marginTop="10dp"
                android:background="@drawable/border_edit_text"
                android:maxLines="1"
                android:minLines="1"
                android:paddingLeft="20dp"
                android:singleLine="true"
                android:textColor="@color/colorConifer"
                android:textSize="18sp" />


            <TextView
                android:id="@+id/passwordLabel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/userNameInput"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:layout_marginTop="10dp"
                android:text="@string/text_password"
                android:textColor="@color/colorConifer"
                android:textSize="18sp" />

            <EditText
                android:id="@+id/passwordInput"
                android:layout_width="match_parent"
                android:layout_height="60dp"
                android:layout_below="@+id/passwordLabel"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:layout_marginTop="10dp"
                android:background="@drawable/border_edit_text"
                android:maxLines="1"
                android:minLines="1"
                android:paddingLeft="20dp"
                android:singleLine="true"
                android:textColor="@color/colorConifer"
                android:textSize="18sp" />


            <!--<Button-->
                <!--android:id="@+id/okButton"-->
                <!--android:layout_width="200dp"-->
                <!--android:layout_height="50dp"-->
                <!--android:layout_below="@+id/passwordInput"-->
                <!--android:layout_marginLeft="20dp"-->
                <!--android:layout_marginTop="40dp"-->
                <!--android:background="@color/colorConifer"-->
                <!--android:text="@string/text_ok"-->
                <!--android:textColor="@android:color/white"-->
                <!--android:textSize="18sp" />-->

        </RelativeLayout>
    <!--</ScrollView>-->

</RelativeLayout>

in AndroidManifest.xml , I have writtenandroid:windowSoftInputMode="adjustResize" against activty, still the layout is not moving up when keyboard is opened. Is there anything missing in the layout?

Mrugesh
  • 4,381
  • 8
  • 42
  • 84

1 Answers1

1

Where did you write windowSoftInputMode in the Manifest?

try

android:windowSoftInputMode="adjustResize"

into the tag <activity> and before <intent-filter> be sure that the instruction is inside the activity you are considering when you want that the soft keyboard raises

EDIT Alternatively you can try to add in onCreate

setWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

and also try to use this in the Manifest

android:windowSoftInputMode="adjustPan|adjustResize"

trocchietto
  • 2,607
  • 2
  • 23
  • 36
  • I have tried it, but it is not giving me any solution – Mrugesh Mar 20 '18 at 13:37
  • if you get rid of ScrollView it works? try before on a less complex layout, with just a text view and add incrementally to see if works. – trocchietto Mar 20 '18 at 13:38
  • I have tried using simple layout. it is moving up . Now, I want to move the layout up till the end , how to do that? (I have updated the code in my question for that) – Mrugesh Mar 20 '18 at 15:02
  • really good Mrugesh, keep adding things, my guess is that with scrollView you could have problems, see also my EDIT above – trocchietto Mar 20 '18 at 15:56