0

Я создал фрагмент со списком прокрутки, который состоит из переработанного вида в нем. но просмотр корзины не отображается в поле зрения, пожалуйста, помогите мне, как это решить, есть ли другой способ сделать это.Recycleview в scrollview

вот мой 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> 

ответ

1

Если вы хотите иметь прокрутки взгляды в ScrollView, вам нужно использовать 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> 
0

Это не лучшая идея для работы, но если вам это действительно нужно, вы должны использовать NestedListView, как говорит @ianhanniballake. Или попробуйте этот способ, описанный в this blog.

Смежные вопросы