android - CardView Scroll behavior when keyboard is up -


our app's main content recylerview of cardview's. signup require more username/password create account decided make signup flow out of cardview's match user experience once sign up.

to have single activity animates fragments in bottom , existing fragments out top emulate scrolling. fake scrolling occurs when user enters data , hits next advance. works pretty except 1 case. when have edittext input keyboard comes , covers 'next' button on bottom of screen.

in our user testing we've noticed high percentage of users trying scroll card next button instead of dismissing keyboard.

i've spent lot of time unsuccessfully trying cardview scroll reveal button , i'm out of ideas , looking new ones.

the signup activity layout contains framelayout load fragments into. each fragment gets loaded has cardview root layout.

in manifest have set activity's windowssoftinputmode adjustresize, adjustpan little success.

activity_signup.xml

<framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/signupcontent" android:layout_width="match_parent" android:layout_height="match_parent"/> 

simplified fragment_enter_code.xml

<android.support.v7.widget.cardview style="@style/cardviewstyle.signup" 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="wrap_content" app:cardcornerradius="25dp" app:cardelevation="2dp" app:cardusecompatpadding="true" app:contentpadding="8dp">          <edittext              android:id="@+id/codeedittext"              style="@style/hintededittext"              android:layout_width="match_parent"              android:layout_height="wrap_content"              android:hint="code"              android:inputtype="text"/>          <button             style="@style/nextbutton"             android:id="@+id/nextbutton"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:enabled="false"             android:text="@string/next"/>  </android.support.v7.widget.cardview> 

when tried putting cardview in scrollview cardview layout (with fillviewport true), scrollbar card doesn't scroll , cardview layout gets messed up.

does know windosoftinputmode's enough point me in right direction? or cardview not going scroll outside of container design hold them?

it feels solution in manipulating activity's view not fragments.

i ended creating new app play around issue , noticed if had layout didn't contain cardview root layout scrollview didn't scroll unless activities windowsoftinputmode set adjustresize , scroll.

i made layout <scrollview><cardview><content...></cardview></scrollview> , size of cardview default row size card , wouldn't match_parent. solved fillviewport="true" on scrollview when keyboard came wouldn't scroll.

turns out secret sauce put framelayout (or anyother layout) in between cardview , scrollview.

you still have account resize of layout prevent view elements not stacking on each other once view above soft keyboard scroll , ability reach rest of ui cardview.

<scrollview     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:layout_width="wrap_content"     android:layout_height="match_parent"     android:fillviewport="true">      <framelayout         android:layout_width="match_parent"         android:layout_height="wrap_content">          <android.support.v7.widget.cardview             android:layout_width="match_parent"             android:layout_height="match_parent"             app:cardcornerradius="35dp"             app:cardelevation="2dp"             app:cardusecompatpadding="true"             app:contentpadding="8dp">              <relativelayout                 android:layout_width="match_parent"                 android:layout_height="match_parent">                  <imageview                     android:id="@+id/image"                     android:layout_width="match_parent"                     android:layout_height="200dp"                     android:src="@drawable/common_ic_googleplayservices"/>                  <edittext                     android:id="@+id/input"                     android:layout_width="match_parent"                     android:layout_height="wrap_content"                     android:layout_margintop="50dp"                     android:layout_marginleft="20dp"                     android:layout_marginright="20dp"                     android:layout_below="@id/image"                     android:hint="input"                     android:inputtype="text"/>                  <linearlayout                     android:layout_width="match_parent"                     android:layout_height="match_parent"                     android:layout_below="@id/input"                     android:orientation="vertical"                     android:gravity="bottom|center_horizontal">                      <button                         android:id="@+id/nextbutton"                         android:layout_width="match_parent"                         android:layout_height="48dp"                         android:layout_marginleft="20dp"                         android:layout_marginright="20dp"                         android:enabled="false"                         android:text="next"/>                  </linearlayout>              </relativelayout>          </android.support.v7.widget.cardview>      </framelayout>  </scrollview> 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -