3

Im trying to do something like facebook login.

enter image description here

enter image description here

where as whole View shifts up and even "Signup for Facebook" text as well.

How do i do this ?

My view code is here, I want to shift this entire relativelayout without keyboard overlapping.

  • It has to work fine for all device and screen resolution.

    <RelativeLayout
    android:id="@+id/fields"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/place"
    android:padding="5dp"
    android:layout_marginTop="10dp"
    android:background="@color/white">
    
    <android.support.design.widget.TextInputLayout
    android:id="@+id/input"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp">
    
    <EditText
        android:id="@+id/username"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:hint="User Name"
        android:textSize="14sp"
        android:inputType="textNoSuggestions|textVisiblePassword"
        android:maxLength="80" />
    
    </android.support.design.widget.TextInputLayout>
    
    <android.support.design.widget.TextInputLayout
    android:id="@+id/password"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/input_layout_user"
    android:layout_marginTop="10dp">
    
    <EditText
        android:id="@+id/password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignEnd="@id/tc"
        android:layout_alignRight="@id/tc"
        android:hint="Password"
        android:imeOptions="actionDone|actionGo"
        android:textSize="14sp"
        android:inputType="textPassword" />
    </android.support.design.widget.TextInputLayout>
    
    
    <CheckBox
    android:id="@+id/checkBox"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/input_layout_password"
    android:text="Keep me logged in"
    android:textSize="14sp"
    android:layout_marginTop="10dp"/>
    
    
    <Button
    android:id="@+id/login"
    android:layout_width="165dp"
    android:layout_height="50dp"
    android:layout_gravity="center_horizontal"
    android:background="@color/red"
    android:text="LOGIN"
    android:textSize="18sp"
    android:textColor="@color/white"
    android:layout_below="@+id/logged_in_checkBox"
    android:layout_alignEnd="@+id/trouble_logging_txt"
    android:layout_marginTop="10dp"/>
    
    <TextView
    android:id="@+id/logging_txt"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/btn_login"
    android:text="Trouble logging in ?"
    android:layout_centerHorizontal="true"
    android:textSize="18sp"
    android:layout_margin="5dp"/>
    </RelativeLayout>
    
Uday
  • 1,619
  • 3
  • 23
  • 48

1 Answers1

2

Add this to your activity in manifest.xml

android:windowSoftInputMode="stateVisible|adjustPan"
Gowtham Raj
  • 2,915
  • 1
  • 24
  • 38