android - Cardview in the recyclerview overlaps the collapsing toolbar -
i trying create recyclerview below collapsing toolbar cardviews inside recyclerview.how overcome overlapping of cardview inflated inside recyclerview. overlaps collapsing toolbar image .
xml file
<?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" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <android.support.design.widget.appbarlayout android:id="@+id/app_bar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar" android:fitssystemwindows="true" > <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollflags="scroll|exituntilcollapsed" app:contentscrim="?attr/colorprimary" app:expandedtitlemarginstart="48dp" app:expandedtitlemarginend="64dp" android:fitssystemwindows="true" > <imageview android:id="@+id/image" android:layout_width="match_parent" android:layout_height="200dp" android:scaletype="centercrop" android:fitssystemwindows="true" app:layout_collapsemode="parallax" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:popuptheme="@style/themeoverlay.appcompat.light" app:layout_collapsemode="pin" /> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> <android.support.v7.widget.recyclerview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/rv" android:orientation="vertical" android:cliptopadding="false" android:layout_margintop="?attr/actionbarsize" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_below="@+id/image" /> <android.support.design.widget.floatingactionbutton android:id="@+id/fab" app:layout_anchor="@id/app_bar_layout" style="@style/fab" app:theme="@style/themeoverlay.appcompat.light" app:layout_anchorgravity="bottom|right|end" /> </android.support.design.widget.coordinatorlayout>
item inflated inside recyclerview
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.cardview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.co nbm/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="6dp" app:cardelevation="6dp" android:padding="6dp" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:id="@+id/cv"> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.co nbm/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#ffffff"> <com.github.siyamed.shapeimageview.circularimageview android:layout_width="100dp" android:layout_height="100dp" android:scaletype="centercrop" android:clipchildren="false" android:cliptopadding="false" android:layout_margin="16dp" android:layout_gravity="center" android:src="@drawable/li" android:id="@+id/imageview" app:siborderwidth="6dp" app:sibordercolor="@color/secondary_text"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textview" android:text="aayush chaubey" android:paddingtop="16dp" android:layout_alignparenttop="true" android:layout_torightof="@+id/imageview" android:textcolor="#000000" android:textsize="20sp" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textview2" android:text="app developer" android:textcolor="#000000" android:textsize="15sp" android:layout_centervertical="true" android:layout_alignleft="@+id/textview" android:layout_alignstart="@+id/textview" /> </relativelayout> </android.support.v7.widget.cardview>
try this:
<?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" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <android.support.v7.widget.recyclerview android:id="@+id/rv" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/app_bar_layout" android:cliptopadding="false" android:orientation="vertical" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <android.support.design.widget.appbarlayout android:id="@+id/app_bar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:fitssystemwindows="true" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" app:contentscrim="?attr/colorprimary" app:expandedtitlemarginend="64dp" app:expandedtitlemarginstart="48dp" app:layout_scrollflags="scroll|exituntilcollapsed"> <imageview android:id="@+id/image" android:layout_width="match_parent" android:layout_height="200dp" android:fitssystemwindows="true" android:scaletype="centercrop" app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_collapsemode="parallax" /> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:layout_collapsemode="pin" app:popuptheme="@style/themeoverlay.appcompat.light" /> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> <android.support.design.widget.floatingactionbutton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_anchor="@id/app_bar_layout" app:layout_anchorgravity="bottom|right|end" app:theme="@style/themeoverlay.appcompat.light" /> </android.support.design.widget.coordinatorlayout>
take also, :
Comments
Post a Comment