Sathya
Sathya

Reputation: 678

ScrollView inside ViewPager is not working when softkeyboard popsup

I have populated my Viewpager with two Fragments.

<RelativeLayout
    android:id="@+id/rel_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <in.mobme.chillr.views.flow.SlidingTabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@color/white"
        android:elevation="2dp"
        app:sldtab_textColorSelected="@color/light_black"
        app:sldtab_textColorUnselected="@color/black"/>

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@id/tabs"/>

</RelativeLayout>

The second fragment is wrapped around a ScrollView

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white">

<RelativeLayout
    android:id="@+id/contentPanel"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="16dp"
    android:padding="16dp">

    <TextView
        android:id="@+id/icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/amount"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:gravity="bottom"
        android:paddingBottom="8dp"
        android:text="$"
        android:textColor="@color/colorPrimary"
        android:textSize="52sp"/>

    <EditText
        android:id="@+id/amount"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/contact_details_scroll"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="16dp"
        android:layout_toRightOf="@+id/rupee_icon"
        android:background="@null"
        android:hint="0"
        android:imeOptions="actionNext"
        android:inputType="number"
        android:maxLength="5"
        android:maxLines="1"
        android:textCursorDrawable="@null"
        android:textSize="52sp"/>

    <EditText
        android:id="@+id/remarks"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/amount"
        android:layout_marginTop="8dp"
        android:hint="Remarks"
        android:imeOptions="actionNext"
        android:inputType="textCapSentences"
        android:maxLength="140"
        android:textCursorDrawable="@null"/>

    <EditText
        android:id="@+id/invoice_id"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/remarks"
        android:layout_marginTop="8dp"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:hint="Reference ID"
        android:imeOptions="actionDone"
        android:maxLength="20"
        android:textCursorDrawable="@null"/>

    <ImageButton
        android:id="@+id/btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:layout_marginTop="32dp"/>

</RelativeLayout></ScrollView>

When pressed on any of the Edittext, it it supposed to make the soft keyboard popup, and thus the scrollview should be active. I can get the ScrollView to work on few phones like the Samsung S4 Mini, Sony Ericcson L, etc. But it does not work on many others like Moto G, Moto E, Samsung S4, etc.

I have added the following parameter for the activity in Manifest

android:windowSoftInputMode="adjustPan"

Anyone knows why this is happening?

Upvotes: 1

Views: 500

Answers (1)

Anitha Manikandan
Anitha Manikandan

Reputation: 1170

Add the following in ScrollView

android:fillViewport="true"

Upvotes: 1

Related Questions