2

I face strange problem with scrollview in kitkat devices. I have fragment which contains two pages the following code is it's Adapter ( Note that I pass getChildFragmentManager to this adapter because it's in another fragment ) :

public class ContactUsPageAdapter extends FragmentPagerAdapter {
    String[] titles={HeyatApplication.getAppContext().getResources().getString(R.string.heyat_title)
                        ,HeyatApplication.getAppContext().getResources().getString(R.string.contact_us_title)};

    public ContactUsPageAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        switch (position){
            case 0:
                return new SubSendHeyatInfo();
            case 1:
                return new SubContactUsFragment();
        }
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public int getCount() {
        return 2;
    }

    @Override
    public CharSequence getPageTitle(int position) {

        return titles[position];
    }
}

Both page contains some EditText in second page (I don't have this problem in first page and it's Okay ) when I click on Edittext the keyboard is hide edittext and buttons ( I Also see other thread in SO and changed my manifest.xml as describe here )

Here is xml of my second page :

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/main_background"
    android:isScrollContainer="false"
    android:fillViewport="true"
    android:paddingTop="25dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="15dp"
        android:orientation="vertical"
        android:paddingBottom="20dp">

        <EditText
            android:id="@+id/hName"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="5dp"
            android:background="@drawable/edittext_back"
            android:gravity="right|center_vertical"
            android:hint="@string/heyat_name"
            android:singleLine="true"
            android:textColor="@color/white"
            android:textColorHint="@color/gray" />

        <EditText
            android:id="@+id/hSpeaker"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="10dp"
            android:background="@drawable/edittext_back"
            android:gravity="right|center_vertical"
            android:hint="@string/heyat_speaker"
            android:singleLine="true"
            android:textColor="@color/white"
            android:textColorHint="@color/gray" />

        <EditText
            android:id="@+id/hSonger"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="10dp"
            android:background="@drawable/edittext_back"
            android:gravity="right|center_vertical"
            android:hint="@string/heyat_songer"
            android:singleLine="true"
            android:textColor="@color/white"
            android:textColorHint="@color/gray" />

        <EditText
            android:id="@+id/hProvince"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="10dp"
            android:background="@drawable/edittext_back"
            android:gravity="right|center_vertical"
            android:hint="@string/heyat_province"
            android:singleLine="true"
            android:textColor="@color/white"
            android:textColorHint="@color/gray" />

        <EditText
            android:id="@+id/hDate"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="10dp"
            android:background="@drawable/edittext_back"
            android:gravity="right|center_vertical"
            android:hint="@string/heyat_time"
            android:singleLine="true"
            android:textColor="@color/white"
            android:textColorHint="@color/gray" />

        <EditText
            android:id="@+id/hContact"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="10dp"
            android:background="@drawable/edittext_back"
            android:gravity="right|center_vertical"
            android:hint="@string/heyat_tel"
            android:singleLine="true"
            android:textColor="@color/white"
            android:textColorHint="@color/gray" />


        <EditText
            android:id="@+id/hAddress"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="10dp"
            android:background="@drawable/edittext_back"
            android:gravity="right"
            android:hint="@string/heyat_address"
            android:lines="5"
            android:paddingBottom="5dp"
            android:paddingTop="5dp"
            android:textColor="@color/white"
            android:textColorHint="@color/gray" />

        <com.rey.material.widget.Button
            android:id="@+id/hSend"
            style="@style/LightFlatButtonRippleStyle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="10dp"
            android:text="@string/contact_us_send"
            app:rd_style="@style/Material.Drawable.Ripple.Wave.Light" />

    </LinearLayout>

</ScrollView>
Community
  • 1
  • 1
Amir
  • 16,067
  • 10
  • 80
  • 119

0 Answers0