ScrollView Inside ViewPager Not Working - android

i have an activity ViewPager and which have Tabbed Childs. The childs with recycler View do Scroll. Although When i create a simple fragment with scroll view it does not work.
here is the main activity fragment -
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:id="#+id/tabbed_main"
android:background="#FFFFFF"
android:screenOrientation="portrait"
xmlns:fab="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="true"
android:scrollbars="none">
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/vp_horizontal_ntb"
android:gravity="center"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:isScrollContainer="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:fitsSystemWindows="true">
<com.gigamole.navigationtabbar.ntb.NavigationTabBar
android:layout_width="match_parent"
android:layout_height="60dp"
android:id="#+id/ntb_horizontal"
app:ntb_badge_size="12sp"
app:ntb_badge_bg_color="#ffff0000"
app:ntb_badge_gravity="top"
app:ntb_badge_position="right"
app:ntb_badge_title_color="#ffffffff"
app:ntb_badge_use_typeface="true"
app:ntb_badged="true"
app:ntb_animation_duration="400" />
</LinearLayout>
<com.getbase.floatingactionbutton.FloatingActionsMenu
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:id="#+id/create_new_button"
android:layout_marginBottom="60dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
fab:fab_addButtonColorNormal="#color/white_add"
fab:fab_addButtonColorPressed="#color/white_pressed"
fab:fab_addButtonPlusIconColor="#color/half_black"
fab:fab_labelStyle="#style/menu_labels_style">
<com.getbase.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/action_create_post"
fab:fab_colorNormal="#color/white_add"
fab:fab_title="Create New Post"
fab:fab_icon="#drawable/ic_create_black_24dp"
fab:fab_colorPressed="#color/white_pressed"/>
<com.getbase.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/action_create_new_message"
fab:fab_colorNormal="#color/white_add"
fab:fab_title="Write New Message"
fab:fab_icon="#drawable/ic_insert_comment_black_24dp"
fab:fab_colorPressed="#color/white_pressed"/>
<com.getbase.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/action_upload_new_album"
fab:fab_colorNormal="#color/white_add"
fab:fab_title="Upload New Album"
fab:fab_icon="#drawable/ic_add_a_photo_black_24dp"
fab:fab_colorPressed="#color/white_pressed"/>
</com.getbase.floatingactionbutton.FloatingActionsMenu>
</android.support.design.widget.CoordinatorLayout>
and here is the child fragment -
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="22dp"
android:paddingLeft="22dp"
android:fillViewport="true"
android:focusableInTouchMode="true"
android:focusable="true"
android:scrollbars="none"
xmlns:tools="http://schemas.android.com/tools"
android:background="#drawable/main_background_blured"
android:isScrollContainer="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:isScrollContainer="true">
<View
android:layout_width="match_parent"
android:layout_height="10dp"/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="5dp"
android:paddingTop="0dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardCornerRadius="4dp"
app:cardElevation="8dp">
<com.evolutionstudios.atmiyo.customfonts.RailwayRegular
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="SETTINGS"
android:layout_gravity="center"
android:gravity="center"
android:textSize="25dp"
android:textColor="#color/main_logo_color"/>
</android.support.v7.widget.CardView>
<View
android:layout_width="match_parent"
android:layout_height="10dp"/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardCornerRadius="4dp"
app:cardElevation="6dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.evolutionstudios.atmiyo.customfonts.TrilliumWebLight
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Security"
android:textColor="#color/half_black"
android:paddingLeft="14dp"
android:textSize="15dp"
android:paddingTop="10dp"
android:paddingBottom="3dp"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="2dp"
android:src="#color/half_black"
android:paddingLeft="10dp"
android:paddingRight="10dp" />
<com.evolutionstudios.atmiyo.customfonts.RailwayLight
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Change Password"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:paddingBottom="5dp"
android:textSize="18dp"
android:textColor="#color/main_logo_color"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:src="#color/edward"
android:paddingLeft="10dp"
android:paddingRight="10dp"/>
<com.evolutionstudios.atmiyo.customfonts.RailwayLight
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Change Default Email"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:textSize="18dp"
android:textColor="#color/main_logo_color"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<View
android:layout_width="match_parent"
android:layout_height="10dp"/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardElevation="6dp"
app:cardCornerRadius="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.evolutionstudios.atmiyo.customfonts.TrilliumWebLight
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="General"
android:textSize="15dp"
android:paddingLeft="14dp"
android:paddingTop="10dp"
android:paddingBottom="3dp"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="2dp"
android:src="#color/half_black"
android:paddingLeft="10dp"
android:paddingRight="10dp" />
<com.evolutionstudios.atmiyo.customfonts.RailwayLight
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Change Name"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:paddingBottom="0dp"
android:textSize="18dp"
android:textColor="#color/main_logo_color"/>
<com.evolutionstudios.atmiyo.customfonts.TrilliumWebLight
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="SomeName"
android:textSize="15dp"
android:paddingLeft="20dp"
android:paddingTop="0dp"
android:paddingBottom="5dp"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:src="#color/edward"
android:paddingLeft="10dp"
android:paddingRight="10dp"/>
<com.evolutionstudios.atmiyo.customfonts.RailwayLight
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Change Phone Number"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:paddingBottom="0dp"
android:textSize="18dp"
android:textColor="#color/main_logo_color"/>
<com.evolutionstudios.atmiyo.customfonts.TrilliumWebLight
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="phone number"
android:textSize="15dp"
android:paddingLeft="20dp"
android:paddingTop="0dp"
android:paddingBottom="10dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardElevation="6dp"
app:cardCornerRadius="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.evolutionstudios.atmiyo.customfonts.TrilliumWebLight
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Blocking"
android:textSize="15dp"
android:paddingLeft="14dp"
android:paddingTop="10dp"
android:paddingBottom="3dp"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="2dp"
android:src="#color/half_black"
android:paddingLeft="10dp"
android:paddingRight="10dp" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingBottom="5dp">
<com.evolutionstudios.atmiyo.customfonts.RailwayLight
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Blocking"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:paddingBottom="0dp"
android:textSize="18dp"
android:layout_alignParentStart="true"
android:textColor="#color/main_logo_color" />
<com.cengalabs.flatui.views.FlatToggleButton
android:layout_width="60dp"
android:layout_height="22dp"
android:layout_alignParentEnd="true"
xmlns:flat="http://schemas.android.com/apk/res-auto"
flat:fl_space="14dp"
flat:fl_cornerRadius="14dp"
flat:fl_size="50dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
flat:fl_theme="#array/grass"/>
</RelativeLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:src="#color/edward"
android:paddingLeft="10dp"
android:paddingRight="10dp"/>
<com.evolutionstudios.atmiyo.customfonts.RailwayLight
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Block List"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:textSize="18dp"
android:textColor="#color/main_logo_color"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardElevation="6dp"
app:cardCornerRadius="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.evolutionstudios.atmiyo.customfonts.TrilliumWebLight
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Language"
android:textSize="15dp"
android:paddingLeft="14dp"
android:paddingTop="10dp"
android:paddingBottom="3dp"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="2dp"
android:src="#color/half_black"
android:paddingLeft="10dp"
android:paddingRight="10dp" />
<com.evolutionstudios.atmiyo.customfonts.RailwayLight
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Change Language"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:paddingBottom="0dp"
android:textSize="18dp"
android:textColor="#color/main_logo_color"/>
<com.evolutionstudios.atmiyo.customfonts.TrilliumWebLight
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="SomeLanguage"
android:textSize="15dp"
android:paddingLeft="20dp"
android:paddingTop="0dp"
android:paddingBottom="10dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
i have tried with a lot of answers here like here, here also and here too
as someone pointed to use NestedScrollView instead ScrollView and i tried that too, but with no luck. Any solutions?

I managed to solve a similar vertical scrolling problem in my ViewPager doing the following:
I created a separate layout (content_event) with ViewPager:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="#+id/viewPagerActivEvent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
</android.support.v4.view.ViewPager>
</RelativeLayout>
And created NestedScrollView enclosing preceding layout with "android:fillViewport" set to true:
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior" >
<include layout="#layout/content_event" >
</android.support.v4.widget.NestedScrollView>
Maybe it's not quite right but worked for me:)

Related

How to scroll an EditText to the very top of the layout?

So I have this layout with some ChipsInput inside a scrollview and I simply want these to go to the very top when the keyboard is activated
I've tried to change windowSoftInputMode to adjustPan and others but it does not make it to go to the very top, just doesn't cover it.
Here's my xml layout
<LinearLayout 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:id="#+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/background1"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<LinearLayout
android:id="#+id/layoutImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="#color/colorPrimary"
android:elevation="12dp"
android:orientation="horizontal"
android:padding="10dp"
tools:targetApi="lollipop">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="3dp"
android:layout_weight="1"
android:fontFamily="#font/quattrocento"
android:gravity="left"
android:text="#string/profile"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#color/textColor1"
tools:ignore="RtlHardcoded" />
<ImageButton
android:id="#+id/btUpdate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:background="#color/colorPrimary"
android:src="#drawable/arrow_right_icon" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="5dp"
android:orientation="vertical"
tools:targetApi="o">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="#font/quattrocento"
android:gravity="center"
android:text="#string/gallery"
android:textSize="22sp"
android:textStyle="bold"
android:textColor="#color/textColor2"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal"
android:padding="5dp"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageButton
android:id="#+id/close1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon_close"
android:background="#color/white"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:elevation="7dp"
android:visibility="invisible"/>
<ImageButton
android:id="#+id/add1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon_add"
android:background="#color/white"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:elevation="7dp"/>
<ImageView
android:id="#+id/photo1"
android:layout_width="match_parent"
android:layout_height="115dp"
android:layout_marginHorizontal="5dp"
android:background="#drawable/rounded_rect_primary_dark"
android:elevation="5dp"
android:scaleType="fitXY"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageButton
android:id="#+id/close2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon_close"
android:background="#color/white"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:elevation="7dp"
android:visibility="invisible"/>
<ImageButton
android:id="#+id/add2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon_add"
android:background="#color/white"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:elevation="7dp"/>
<ImageView
android:id="#+id/photo2"
android:layout_width="match_parent"
android:layout_height="115dp"
android:layout_marginHorizontal="5dp"
android:background="#drawable/rounded_rect_primary_dark"
android:elevation="5dp"
android:scaleType="fitXY" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageButton
android:id="#+id/close3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon_close"
android:background="#color/white"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:elevation="7dp"
android:visibility="invisible"/>
<ImageButton
android:id="#+id/add3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon_add"
android:background="#color/white"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:elevation="7dp"/>
<ImageView
android:id="#+id/photo3"
android:layout_width="match_parent"
android:layout_height="115dp"
android:layout_marginHorizontal="5dp"
android:background="#drawable/rounded_rect_primary_dark"
android:elevation="5dp"
android:scaleType="fitXY"/>
</RelativeLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginHorizontal="12dp"
android:layout_marginVertical="5dp"
android:background="#color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/quattrocento"
android:text="#string/about_me"
android:textColor="#color/textColor2"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#color/white">
<EditText
android:id="#+id/description"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="#color/white"
android:focusable="true"
android:maxLength="500"
android:inputType="text"
android:importantForAutofill="no"
android:autofillHints="no"
tools:ignore="LabelFor" />
<TextView
android:id="#+id/caracCounter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/quattrocento"
android:text="500"
android:textColor="#color/black"
android:textSize="16sp"
android:layout_gravity="end" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/quattrocento"
android:text="#string/interest1"
android:textColor="#color/textColor2"
android:textSize="20sp"
android:layout_gravity="center"
android:gravity="center"/>
<Spinner
android:id="#+id/categories1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:background="#color/colorPrimary" />
</LinearLayout>
<com.pchmn.materialchips.ChipsInput
android:id="#+id/chipsInput1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#color/white"
android:elevation="3dp"
android:focusable="false"
app:chip_deletable="true"
app:chip_hasAvatarIcon="false"
app:hint="#"
app:chip_backgroundColor="#color/colorPrimary"
app:chip_deleteIconColor="#color/black"
app:chip_labelColor="#color/black"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/quattrocento"
android:text="#string/interest2"
android:textColor="#color/textColor2"
android:textSize="20sp"
android:layout_gravity="center"
android:gravity="center"/>
<Spinner
android:id="#+id/categories2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:background="#color/colorPrimary" />
</LinearLayout>
<com.pchmn.materialchips.ChipsInput
android:id="#+id/chipsInput2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#color/white"
android:elevation="3dp"
android:focusable="false"
app:chip_deletable="true"
app:chip_hasAvatarIcon="false"
app:hint="#"
app:chip_backgroundColor="#color/colorPrimary"
app:chip_deleteIconColor="#color/black"
app:chip_labelColor="#color/black" />
<Button
android:id="#+id/btLogout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="25dp"
android:background="#color/colorPrimary"
android:elevation="12dp"
android:fontFamily="#font/quattrocento"
android:text="#string/logout"
android:textSize="20sp"
android:onClick="logout"
tools:targetApi="lollipop"
android:textColor="#color/black"/>
</LinearLayout>
</ScrollView>
I simply need it to be sent to the very top of the layout so my filterable list will appear when the user start to type.
You can use CoordinatorLayout as your root and NestedScrolView in it .
CoordinatorLayout as root reacts to keyboard and scrolls your layout to the top of your phone with assistant of NestedScrollView which your NestedScrollView includes your layout code .
To put the issue into perspective view
CoordinaterLayout > NestedScrolView > yourLayout
Change your layout XMl like code below
<android.support.design.widget.CoordinatorLayout
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.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/background1"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<!-- rest of your layout xml code-->
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

How to fixed header when keyboard shown android

I am working on fixed header, when focus edittext-> keyboard pushed the header will not be pushed but only the content is pushed. My problem here is that when I use fullscreen + adjustsize code, the header is kept but the content is covered by the keyboard, I add fitsystemwindow in xml is but when the keyboard hide empty space at the bottom Make sure you hide navigation. So how can I keep the header is not scroll, but fullscreen, hide navigation. thanks
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:id="#+id/layoutCRC"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/base"
android:baselineAligned="false"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:weightSum="1">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="12dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="#dimen/layout_marginLeftPL"
android:layout_marginRight="#dimen/layout_marginRightPL"
android:layout_weight="0.23"
android:background="#drawable/layout_crc"
android:orientation="vertical"
android:weightSum="3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:layout_weight="1.35"
android:gravity="center"
android:orientation="horizontal">
<com.fecredit.hostedkios.widgets.TextViewPlus
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:text="#string/textOCredit"
android:textColor="#color/colortext_loan"
android:textSize="#dimen/textSize"
android:textStyle="bold"
app:font="#string/FtraBd" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.1"
android:orientation="vertical"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="20dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:orientation="vertical">
<com.fecredit.hostedkios.widgets.TextViewPlus
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:gravity="center_vertical"
android:text="#string/textStep1"
android:textColor="#color/colorButton"
android:textSize="#dimen/textSizeContentPL"
android:textStyle="bold"
app:font="#string/SVN" />
</LinearLayout>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_weight="0.5"
android:orientation="vertical"
android:weightSum="2">
<com.fecredit.hostedkios.widgets.RadioButtonPlus
android:id="#+id/radioPayroll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.9"
android:buttonTint="#color/colortext_loan"
android:text="#string/textpayroll"
android:textColor="#color/colorButton"
app:radiofont="#string/FtraBk" />
<com.fecredit.hostedkios.widgets.RadioButtonPlus
android:id="#+id/rdbVehicleRegistration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1.1"
android:buttonTint="#color/colortext_loan"
android:gravity="center_vertical"
android:text="#string/textcarparachute"
android:textColor="#color/colorButton"
app:radiofont="#string/FtraBk" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:layout_weight="0.55"
android:orientation="vertical"
android:weightSum="4">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.1"
android:orientation="horizontal">
<com.fecredit.hostedkios.widgets.TextViewPlus
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:gravity="center_vertical"
android:text="#string/step2"
android:textColor="#color/colorButton"
android:textSize="#dimen/textSizeContentPL"
android:textStyle="bold"
app:font="#string/SVN" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="25dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_weight="0.97"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/lvname"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="30dp"
android:layout_weight="0.5"
android:gravity="center_vertical">
<com.fecredit.hostedkios.widgets.EditTextViewPlus
android:id="#+id/edtFullNameCRC"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/custom_input"
android:hint="#string/name"
android:imeOptions="actionNext"
android:inputType="textNoSuggestions"
android:nextFocusForward="#+id/edtPhoneCRC"
android:paddingBottom="7dp"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingTop="7dp"
android:textColorHint="#color/colorButton"
app:editfont="#string/FtraBk" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="30dp"
android:layout_weight="0.5"
android:gravity="center_vertical">
<com.fecredit.hostedkios.widgets.EditTextViewPlus
android:id="#+id/edtIndentifyCRC"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/custom_input"
android:hint="#string/ID"
android:imeOptions="actionNext"
android:inputType="numberPassword"
android:maxLength="12"
android:nextFocusForward="#+id/edtEmailCRC"
android:paddingBottom="7dp"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingTop="7dp"
android:textColorHint="#color/colorButton"
app:editfont="#string/FtraBk" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="25dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_weight="0.97"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="30dp"
android:layout_weight="0.5"
android:gravity="center_vertical">
<com.fecredit.hostedkios.widgets.EditTextViewPlus
android:id="#+id/edtPhoneCRC"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/custom_input"
android:hint="#string/phoneNumber"
android:imeOptions="actionNext"
android:inputType="numberPassword"
android:maxLength="11"
android:nextFocusForward="#+id/edtIndentifyCRC"
android:paddingBottom="7dp"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingTop="7dp"
android:textColorHint="#color/colorButton"
app:editfont="#string/FtraBk" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="30dp"
android:layout_weight="0.5"
android:gravity="center_vertical">
<com.fecredit.hostedkios.widgets.EditTextViewPlus
android:id="#+id/edtEmailCRC"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/custom_input"
android:hint="#string/email"
android:imeOptions="actionDone"
android:inputType="textEmailAddress"
android:paddingBottom="7dp"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingTop="7dp"
android:textColorHint="#color/colorButton"
app:editfont="#string/FtraBk" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="25dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_weight="0.96"
android:orientation="horizontal"
android:weightSum="1">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginRight="30dp"
android:layout_weight="0.5"
android:gravity="center_horizontal">
<com.fecredit.hostedkios.widgets.EditTextViewPlus
android:id="#+id/edtDateCRC"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#drawable/custom_input"
android:focusable="false"
android:hint="#string/date"
android:inputType="textPersonName"
android:nextFocusForward="#+id/edtIndentifyCRC"
android:paddingBottom="7dp"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingTop="7dp"
android:textColorHint="#color/colorButton"
app:editfont="#string/FtraBk" />
<ImageView
android:id="#+id/imgDateCRC"
android:layout_width="#dimen/imgDate"
android:layout_height="#dimen/imgHeightDate"
android:layout_gravity="right|center_vertical"
app:srcCompat="#drawable/calendarblack" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="30dp"
android:layout_weight="0.5"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical">
<Spinner
android:id="#+id/spinnerProvinceCRC"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#drawable/custom_input"
android:gravity="center"
android:imeOptions="actionDone"
android:inputType="textPersonName"
android:paddingBottom="7dp"
android:paddingTop="7dp"
android:popupBackground="#drawable/custom_spinner"
android:spinnerMode="dropdown"
android:textColorHint="#color/colorButton" />
</LinearLayout>
<ImageView
android:id="#+id/imageView6"
android:layout_width="#dimen/imgDate"
android:layout_height="#dimen/imgHeightProvince"
android:layout_gravity="right|center_vertical"
app:srcCompat="#drawable/loction" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_weight="0.77"
android:gravity="center_vertical"
android:orientation="horizontal">
<FrameLayout
android:id="#+id/layoutFooter"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="125dp"
android:background="#drawable/thanhmain"
android:gravity="right">
<com.fecredit.hostedkios.widgets.ButtonPlus
android:id="#+id/btnSendCRC"
android:layout_width="#dimen/layout_widthButtonSelect"
android:layout_height="#dimen/layout_heightButtonSelect"
android:layout_gravity="center"
android:layout_marginBottom="17dp"
android:layout_marginRight="#dimen/layout_marginRightPL"
android:background="#drawable/custom_button"
android:text="#string/btnSend"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="#dimen/textSizeButton"
android:textStyle="bold"
app:buttonfont="#string/FtraBd" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="30dp">
<ImageView
android:id="#+id/imgBackCRC"
android:layout_width="#dimen/layout_widthImageBack"
android:layout_height="#dimen/layout_heightImageBack"
android:layout_gravity="center"
android:layout_marginBottom="5dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="25dp"
app:srcCompat="#drawable/goback" />
</LinearLayout>
</FrameLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>

My App's XML TOO SLOW

My XML is too slow, and I already found other's example but it didn't help mine.
See My XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:windowSoftInputMode="adjustResize">
<!--Preview Card-->
<android.support.v7.widget.CardView
android:id="#+id/preview"
android:layout_width="380dp"
android:layout_height="213.75dp"
android:background="#drawable/ic_ending"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true">
<ImageView
android:id="#+id/preview_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="#drawable/bg_1" />
<ImageView
android:id="#+id/preview_black"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.3"
android:src="#000000" />
<TextView
android:id="#+id/preview_text1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="#string/input_text"
android:textColor="#FFFFFF"
android:textAlignment="center"
android:textSize="20sp" />
</android.support.v7.widget.CardView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--Empty Card-->
<android.support.v7.widget.CardView
android:id="#+id/preview_empty"
android:layout_width="380dp"
android:layout_height="213.75dp"
android:background="#drawable/ic_ending"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true">
</android.support.v7.widget.CardView>
<!--Menu_1 Card-->
<android.support.v7.widget.CardView
android:id="#+id/menu_1"
android:layout_width="380dp"
android:layout_height="wrap_content"
android:background="#drawable/ic_ending"
android:layout_below="#+id/preview_empty"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--Text Font-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:text="#string/text_font"
android:textStyle="bold"
android:textSize="16sp"/>
<Spinner
android:id="#+id/dropdown_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginRight="#dimen/usual_margin"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/colortext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginBottom="#dimen/usual_margin"
android:layout_weight="1"
app:srcCompat="#drawable/ic_format_color_text"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"/>
<ImageView
android:id="#+id/boldtext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginBottom="#dimen/usual_margin"
android:layout_weight="1"
app:srcCompat="#drawable/ic_format_bold"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground" />
<ImageView
android:id="#+id/italictext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginBottom="#dimen/usual_margin"
android:layout_weight="1"
app:srcCompat="#drawable/ic_format_italic"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"/>
</LinearLayout>
</LinearLayout>
<!--Text Size-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/text_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:text="#string/text_size"
android:textStyle="bold"
android:textSize="16sp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="#dimen/usual_margin">
<SeekBar
android:id="#+id/textsize_sb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toStartOf="#+id/textsize_edit"
android:layout_centerInParent="true"
android:progress="20"
android:max="99"/>
<EditText
android:id="#+id/textsize_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:ems="2"
android:maxLength="2"
android:text="20"
android:textAlignment="center"
android:inputType="number" />
</RelativeLayout>
</LinearLayout>
<!--Input Text-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/input_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/usual_margin"
android:text="#string/input_text"
android:textStyle="bold"
android:textSize="16sp"/>
<EditText
android:id="#+id/inputtext_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginRight="#dimen/usual_margin"
android:layout_marginBottom="#dimen/usual_margin"
android:ems="10"
android:inputType="text|textMultiLine|textCapSentences"
android:text="#string/input_text" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<!--Menu_2 Card-->
<android.support.v7.widget.CardView
android:id="#+id/menu_2"
android:layout_width="380dp"
android:layout_height="wrap_content"
android:background="#drawable/ic_ending"
android:layout_below="#+id/menu_1"
android:layout_marginTop="20dp"
android:layout_marginBottom= "80dp"
android:layout_centerHorizontal="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--Outer_Glow-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/text_glow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:text="#string/outer_glow"
android:textStyle="bold"
android:shadowRadius="20"
android:shadowColor="#color/colorWhite"
android:shadowDx="0"
android:shadowDy="0"
android:textSize="16sp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="#dimen/usual_margin">
<SeekBar
android:id="#+id/glow_sb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toStartOf="#+id/glow_edit"
android:layout_centerInParent="true"
android:progress="20"
android:max="99"/>
<EditText
android:id="#+id/glow_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:ems="2"
android:maxLength="2"
android:text="20"
android:textAlignment="center"
android:inputType="number" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
</ScrollView>
<!--Preview Guideline -->
<ImageView
android:layout_width="match_parent"
android:layout_height="253.75dp"
android:src="#FAFAFA"/>
<!--Save Button-->
<android.support.design.widget.FloatingActionButton
android:id="#+id/saveexp"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="#dimen/usual_margin"
android:layout_marginRight="#dimen/usual_margin"
android:clickable="true"
android:src="#drawable/ic_save"
android:tint="#FFFFFF"
app:fabSize="normal"/>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
That's it, and even it's hard to scroll it.
I already check java code, but it's not slow, but when I check xml code in temp app without java code, it is hard to scroll.
Is this structure bad?
Or why is it too slow...
What can I do? Thanks for your answering.

scrolling cardview is not working

I am new in android app development. I am making a project in android-studio. I want to list of cardview that will slide. If anyone knows the answer,please share your answer and xml code too.My xml code is below
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
android:background="#drawable/images"
tools:context="litifer.awesome.game.cardview.MainActivity"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cardView1"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:cardCornerRadius="5dp"
app:cardElevation="5dp"
android:clickable="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cardView1Text"
android:text="Get in Touch"
android:textSize="20dp"
android:paddingTop="40dp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cardView1Edit"
android:hint="Enter Email here"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/cardView1Button"
android:text="Submit"
android:layout_gravity="center" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="40dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:id="#+id/cardView2"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:cardCornerRadius="5dp"
app:cardElevation="5dp"
android:clickable="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cardView2Text"
android:text="Bluetooth demo"
android:textSize="20dp"
android:paddingTop="20dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cardView1Text1"
android:text="Send Notification when in Bluetooth range"
android:textSize="20dp"
android:clickable="true"
android:paddingBottom="40dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:id="#+id/cardView3"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:cardCornerRadius="5dp"
app:cardElevation="5dp"
android:clickable="true"
android:paddingTop="40dp"
android:paddingBottom="40dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cardView3Text"
android:text="Wifi Demo"
android:textSize="20dp"
android:paddingTop="40dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cardView3Text1"
android:text="Send Notification when in Wifi range"
android:textSize="20dp"
android:paddingBottom="40dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cardView4"
android:layout_marginTop="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:cardCornerRadius="5dp"
app:cardElevation="5dp"
android:layout_gravity="center"
android:clickable="true"
android:paddingTop="40dp"
android:paddingBottom="40dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cardView4Text"
android:text="Review Demo"
android:textSize="20dp"
android:paddingTop="40dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cardView4Text1"
android:text="Get Customer Reviews using beacons"
android:textSize="20dp"
android:paddingBottom="40dp"/>
</LinearLayout>
</android.support.v7.widget.CardView></LinearLayout>
Find the solution
<ScrollView 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:fillViewReport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/images"
tools:context="litifer.awesome.game.cardview.MainActivity">
//-----------
//-----------
</LinearLayout>
</ScrollView>

Keyboard shrinking EditText

I have three EditText in my layout. When i click on any of them then it shrinks my layout and the second layout is barely visible. I want that when i click on second layout ("Dear Parents"), keyboard should overlap the last edittext (teachers name) and when i click on last edittext then it should appear above keyboard.
Here are the screenshots
and here is the code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/actionbar_title_color"
android:orientation="vertical">
<include
android:id="#+id/include"
layout="#layout/toolbar" />
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="25dp"
card_view:cardElevation="10sp"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#drawable/filebinder" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="14"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:orientation="vertical">
<TextView
android:id="#+id/dateDiary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="sans-serif"
android:text="30 July"
android:textColor="#03a9f4"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="10dp"
android:background="#03a9f4" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/diarybookmark" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<EditText
android:id="#+id/diaryHeading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:ems="5"
android:fontFamily="sans-serif"
android:hint="Diary Heading"
android:inputType="textPersonName"
android:textAlignment="center"
android:textColor="#000000"
android:textSize="18sp" />
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="#+id/diaryTeacherName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:fontFamily="sans-serif"
android:hint="Teacher\'s Name..."
android:textSize="16sp" />
<at.markushi.ui.CircleButton
android:id="#+id/addDiaryEntry"
android:layout_width="74dip"
android:layout_height="74dip"
android:layout_gravity="right"
android:src="#drawable/ic_action_tick"
app:cb_color="#color/actionbar_title_color"
app:cb_pressedRingWidth="8dip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<EditText
android:id="#+id/diaryContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/addDiaryEntry"
android:layout_alignLeft="#+id/scrollView"
android:layout_alignStart="#+id/scrollView"
android:layout_alignTop="#+id/scrollView"
android:fontFamily="sans-serif"
android:gravity="top"
android:hint="Enter Diary Note...\n\n\n\n"
android:text="Dear Parents,"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
and here is my manifest
<activity
android:name=".DiaryEntry.DiaryEntryTeacherActivity"
android:label="DiaryEntry"
android:windowSoftInputMode="adjustResize"
android:theme="#style/AppTheme.NoActionBar"></activity>
You need to use ScrollView as;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/actionbar_title_color"
android:orientation="vertical">
<include
android:id="#+id/include"
layout="#layout/toolbar" />
<ScrollView
android:id="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="25dp"
card_view:cardElevation="10sp"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#drawable/filebinder" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="14"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:orientation="vertical">
<TextView
android:id="#+id/dateDiary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="sans-serif"
android:text="30 July"
android:textColor="#03a9f4"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="10dp"
android:background="#03a9f4" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/diarybookmark" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<EditText
android:id="#+id/diaryHeading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:ems="5"
android:fontFamily="sans-serif"
android:hint="Diary Heading"
android:inputType="textPersonName"
android:textAlignment="center"
android:textColor="#000000"
android:textSize="18sp" />
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="#+id/diaryTeacherName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:fontFamily="sans-serif"
android:hint="Teacher\'s Name..."
android:textSize="16sp" />
<at.markushi.ui.CircleButton
android:id="#+id/addDiaryEntry"
android:layout_width="74dip"
android:layout_height="74dip"
android:layout_gravity="right"
android:src="#drawable/ic_action_tick"
app:cb_color="#color/actionbar_title_color"
app:cb_pressedRingWidth="8dip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<EditText
android:id="#+id/diaryContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/addDiaryEntry"
android:layout_alignLeft="#+id/scrollView"
android:layout_alignStart="#+id/scrollView"
android:layout_alignTop="#+id/scrollView"
android:fontFamily="sans-serif"
android:gravity="top"
android:hint="Enter Diary Note...\n\n\n\n"
android:text="Dear Parents,"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</ScrollView>
</LinearLayout>

Categories

Resources