1

I have created a fragment with scroll view which consist of recycle view in it. but the recycle view is not getting displayed in view please help me how to solve this, is there any other way to do this.

here is my layout.xml

<?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="wrap_content"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:paddingTop="8dp" android:paddingLeft="8dp" android:paddingRight="8dp" android:paddingBottom="8dp" android:background="#FFFFFF"> <ImageView android:id="@+id/productdetailpage_productimage" android:layout_width="400dp" android:layout_height="400dp" android:src="@drawable/product_image_menswear" android:background="#FFFFFF"/> <Button android:id="@+id/floatingbutton" android:layout_marginTop="390dp" android:layout_marginLeft="285dp" android:layout_width="60dp" android:layout_height="60dp" android:background="@drawable/shareicon"/> <Button android:id="@+id/productdetailpage_share" android:layout_width="30dp" android:layout_height="30dp" android:layout_marginTop="30dp" android:layout_marginLeft="300dp" android:background="@drawable/ic_share_grey600_18dp" /> <Button android:id="@+id/productdetailpage_likebutton" android:layout_width="30dp" android:layout_height="30dp" android:layout_marginTop="30dp" android:layout_marginLeft="50dp" android:background="@drawable/ic_favorite_outline_red_18dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="65dp" android:layout_marginLeft="47dp" android:text="likes(20)" android:textSize="10dp"/> <View android:id="@+id/productdetailpage_separator2" android:layout_width="fill_parent" android:layout_height="2px" android:layout_below="@+id/productdetailpage_productimage" android:layout_marginBottom="2dp" android:layout_marginTop="15dp" android:background="#90909090" /> <TextView android:id="@+id/productdetailpage_productname" android:layout_width="230dp" android:layout_height="wrap_content" android:text="Burton Maroon Casual" android:textColor="#000000" android:textSize="20dp" android:layout_marginTop="4dp" android:layout_marginLeft="8dp" android:layout_below="@+id/productdetailpage_separator2" /> <TextView android:id="@+id/productdetailpage_price" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Rs.3000" android:textColor="#FB8C00" android:textSize="15dp" android:layout_marginTop="10dp" android:layout_marginLeft="8dp" android:layout_below="@+id/productdetailpage_productname" /> <View android:id="@+id/productdetailpage_separator3" android:layout_width="fill_parent" android:layout_height="2px" android:layout_below="@+id/productdetailpage_price" android:layout_marginBottom="2dp" android:layout_marginTop="15dp" android:background="#90909090" /> <TextView android:id="@+id/productdetailpage_description" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/productdetailpage_separator3" android:layout_marginTop="14dp" android:layout_marginLeft="8dp" android:layout_marginRight="8dp" android:layout_gravity="center_vertical" android:text="Look uber trendy and cool wearing this maroon coloured shirt from the house of Burton. Made of cotton, this printed shirt for men will keep you sweat free and comfortable all day long. This snazzy casual shirt will be a perfect addition to your wardrobe." /> <View android:id="@+id/productdetailpage_separator4" android:layout_width="fill_parent" android:layout_height="2px" android:layout_below="@+id/productdetailpage_description" android:layout_marginBottom="2dp" android:layout_marginTop="15dp" android:background="#90909090" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/availabestore_header" android:text="Available in 15 stores" android:layout_marginTop="14dp" android:layout_marginLeft="8dp" android:layout_marginRight="8dp" android:layout_marginBottom="14dp" android:textColor="@color/primaryColor" android:layout_below="@+id/productdetailpage_separator4"/> <android.support.v7.widget.RecyclerView android:paddingTop="8dp" android:id="@+id/available_storeslist_productpage" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/availabestore_header" ></android.support.v7.widget.RecyclerView> </RelativeLayout> </ScrollView> 

2 Answers 2

2

If you want to have scrolling views within a ScrollView, you need to use NestedScrollView:

<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> ... </android.support.v4.widget.NestedScrollView> 
Sign up to request clarification or add additional context in comments.

Comments

0

It's not the best idea for performance, but if you really need it, you should use NestedListView, as @ianhanniballake says. Or try thу way discribed in this blog.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.