android - Why Recyclerview not Scrolls when its height is taken match parent in below xml? -
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="#fff" > <linearlayout android:id="@+id/linear_layout_id" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorprimary" android:orientation="horizontal"> <imageview android:layout_width="0dp" android:layout_weight="1" android:layout_height="24dp" android:src="@drawable/ic_search" android:layout_margintop="12dp" android:layout_marginleft="5dp" android:singleline="true" /> <edittext android:id="@+id/autocomplete_places" android:layout_width="0dp" android:layout_weight="9" android:layout_height="50dp" android:drawablepadding="9dp" android:hint="@string/autocomplete_hint" android:paddingleft="5dp" android:paddingright="9dp" android:singleline="true" android:background="@android:color/transparent" android:textcolor="#fff" android:textcolorhint="@color/white" android:visibility="visible" /> <imageview android:id="@+id/cross" android:singleline="true" android:layout_weight="1" android:layout_width="0dp" android:layout_height="24dp" android:src="@drawable/ic_clear" android:layout_marginright="7dp" android:layout_margintop="12dp" android:visibility="gone" /> </linearlayout> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/linear_layout_id" android:id="@+id/pick_position_layout_id" android:padding="4dp" android:background="@color/window_background" > <android.support.v7.widget.cardview android:layout_width="match_parent" android:layout_height="wrap_content" app:cardcornerradius="4dp" android:elevation="4dp"> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <imageview android:layout_width="wrap_content" android:layout_height="20dp" android:src="@drawable/ic_gps" android:tint="@color/common_action_bar_splitter" android:layout_margintop="10dp" android:layout_marginleft="10dp"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="10dp" android:text="use location"/> </linearlayout> </android.support.v7.widget.cardview> </relativelayout> <android.support.v7.widget.recyclerview android:id="@+id/recyclerviewid" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/pick_position_layout_id" android:scrollbars="vertical"/> <android.support.v7.widget.recyclerview android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/linear_layout_id" android:scrollbars="vertical" /> </relativelayout>
above complete xml file.my problem when in below recyclerview make height wrap_content scrolls when made match_parent not scroll can tell me reason?
<android.support.v7.widget.recyclerview android:id="@+id/recyclerviewid" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/pick_position_layout_id" android:scrollbars="vertical"/>
but recyclerview works both match_parent , wrap_content.
<android.support.v7.widget.recyclerview android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/linear_layout_id" android:scrollbars="vertical" />
can tell me reason? in advance :)
Comments
Post a Comment