android - Recyclerview inside linearlayout scrolling smoothly -


i working on screen has 1 tool bar information of product , list of similar products.

<relativelayout> <toolbar /> <scrollbar>     <linearlayout>         <productinfo />         <textview > <!--similar products -->         <recyclerview />     </linearlayout> </scrollbar> 

everything working fine except scroll. scroll not smooth when recyclerview comes on screen. think idea should have recycler view without own scrollbar. because seems i'm ending 2 scrollbars making scrolling painful. there way through can disable scrollbar of recyclerview , stretch to occupy required height , parent scrollbar scroll screen smoothly?

i'm using staggeredgridlayoutmanager can use both productinfo view , similar products card in single recyclerview, productinfo need complete width of screen similar product need 2 column. please code:

> <android.support.v7.widget.toolbar     android:id="@+id/toolbar"     android:layout_width="match_parent"     android:layout_height="?attr/actionbarsize"     app:navigationicon="?attr/homeasupindicator"     android:background="@color/primary"     android:elevation="10dp" />  <scrollview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:id="@+id/scrollview"     android:fillviewport="true">      <linearlayout         android:orientation="vertical"         android:layout_width="match_parent"         android:layout_height="match_parent">          <android.support.v7.widget.cardview             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_margintop="?attr/actionbarsize">             <linearlayout                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:orientation="vertical">                   <imageview                     android:layout_width="match_parent"                     android:layout_height="wrap_content"                     android:id="@+id/imgproduct"                     android:elevation="10dp"                     android:src="@drawable/placeholder"                     android:layout_margin="10dp"                     android:background="#ffffff" />                  <linearlayout                     android:orientation="vertical"                     android:layout_width="match_parent"                     android:layout_height="wrap_content">                     <linearlayout                         android:orientation="horizontal"                         android:layout_width="match_parent"                         android:layout_height="wrap_content"                         android:layout_below="@+id/view"                         android:showdividers="end">                          <framelayout                             android:id="@+id/frame"                             android:layout_width="60dp"                             android:layout_height="60dp">                              <imageview                                 android:layout_width="60dp"                                 android:layout_height="60dp"                                 android:id="@+id/imgprofile"                                 android:src="@drawable/ic_action_profile_black" />                              <imageview                                 android:id="@+id/circle_crop"                                 android:layout_width="60dp"                                 android:layout_height="60dp"                                 android:src="@drawable/circle_crop" />                           </framelayout>                          <linearlayout                             android:orientation="vertical"                             android:layout_width="match_parent"                             android:layout_height="match_parent"                             android:layout_marginleft="20dp">                              <textview                                 android:layout_width="wrap_content"                                 android:layout_height="wrap_content"                                 android:textappearance="?android:attr/textappearancemedium"                                 android:text="medium text"                                 android:id="@+id/txtusername"                                 android:layout_gravity="center_vertical"                                 android:textcolor="@color/primary_text" />                              <textview                                 android:layout_width="wrap_content"                                 android:layout_height="wrap_content"                                 android:textappearance="?android:attr/textappearancesmall"                                 android:text="small text"                                 android:id="@+id/txttime" />                         </linearlayout>                      </linearlayout>                      <textview                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:textappearance="?android:attr/textappearancemedium"                         android:text="medium text"                         android:id="@+id/txtproductname"                         android:layout_marginleft="20dp"                         android:textcolor="@color/primary_text" />                      <textview                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:textappearance="?android:attr/textappearancemedium"                         android:text="medium text"                         android:id="@+id/txtdescription"                         android:layout_marginleft="20dp" />                      <linearlayout                         android:orientation="horizontal"                         android:layout_width="match_parent"                         android:layout_height="wrap_content"                         android:layout_margintop="20dp"                         android:paddingleft="5dp"                         android:paddingright="5dp"                         android:id="@+id/tagscontainer">                      </linearlayout>                      <linearlayout                         android:orientation="horizontal"                         android:layout_width="match_parent"                         android:layout_height="wrap_content"                         android:layout_margintop="20dp"                         android:paddingleft="5dp"                         android:paddingright="5dp">                          <textview                             android:layout_width="wrap_content"                             android:layout_height="wrap_content"                             android:textappearance="?android:attr/textappearancemedium"                             android:text="10 likes"                             android:id="@+id/txtlikes"                             android:layout_weight="1"                             android:textsize="16sp"                             android:textalignment="center" />                          <textview                             android:layout_width="wrap_content"                             android:layout_height="wrap_content"                             android:textappearance="?android:attr/textappearancemedium"                             android:text="10 comments"                             android:id="@+id/txtcomments"                             android:layout_weight="1"                             android:textsize="16sp"                             android:textalignment="center" />                          <textview                             android:layout_width="wrap_content"                             android:layout_height="wrap_content"                             android:textappearance="?android:attr/textappearancemedium"                             android:text="100 times viewed"                             android:id="@+id/txtviews"                             android:layout_weight="1"                             android:textsize="16sp"                             android:textalignment="center" />                     </linearlayout>                      <linearlayout                         android:orientation="horizontal"                         android:layout_width="match_parent"                         android:layout_height="wrap_content"                         android:layout_margintop="20dp" >                          <imageview                             android:layout_width="wrap_content"                             android:layout_height="30dp"                             android:id="@+id/imglike"                             android:src="@drawable/ic_action_like_black"                             android:layout_weight="1"                             android:layout_gravity="center_vertical" />                          <imageview                             android:layout_width="wrap_content"                             android:layout_height="30dp"                             android:id="@+id/imgcomment"                             android:src="@drawable/ic_action_comment_black"                             android:layout_weight="1"                             android:layout_gravity="center_vertical" />                          <imageview                             android:layout_width="wrap_content"                             android:layout_height="30dp"                             android:id="@+id/imgshare"                             android:src="@drawable/ic_action_share_black"                             android:layout_weight="1"                             android:layout_gravity="center_vertical" />                          <button                             android:layout_width="wrap_content"                             android:layout_height="30dp"                             android:text="buy"                             android:id="@+id/btnbuy"                             android:background="@drawable/btncorner"                             android:layout_margin="10dp"                             android:textcolor="@color/primary_text"                             android:elevation="10dp"                              android:layout_weight="1"                             android:layout_gravity="center_vertical" />                     </linearlayout>                   </linearlayout>              </linearlayout>         </android.support.v7.widget.cardview>          <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:textappearance="?android:attr/textappearancemedium"             android:text="loading similar products.."             android:id="@+id/txtsimilarproducts"             android:layout_alignparentbottom="true"             android:layout_alignparentleft="true"             android:layout_alignparentstart="true"             android:layout_margintop="5dp" />          <android.support.v7.widget.recyclerview             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:id="@id/feedcontainer"             android:scrollbars="none">          </android.support.v7.widget.recyclerview>     </linearlayout> </scrollview> 

for smooth scrolling should use <scrollview> instead of <scrollbar>.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -