0

我要添加垂直以及垂直滚动视图内水平RecyclerViews内水平,垂直RecyclerView。我如何添加一个垂直滚动

是否有可能在vertcal scrollview中有多个回收站视图 我需要使用哪些控件。

此外,RecyclerView嵌套在一个ScrollView中不是很好的做法,所以任何人都可以告诉我什么是正确的方法做到这一点,我可以在另一个RecyclerView中添加RecyclerView,或者我只需要使用水平和垂直滚动视图来实现这一点。

+0

你的问题不是很清楚,你能解释一下你到底想要达到什么目的吗? – thepoosh

+0

在另一个滚动视图中使用可滚动视图不是一个好主意。如果你愿意,你应该设置回收站视图的默认高度。 – ajantha

+0

我想实现的东西像谷歌玩网页 – alphanso

回答

0

您可以获得两个RecyclerView嵌套在一个滚动型这是不推荐的方式做这样的事情。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:custom="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    xmlns:app="http://schemas.android.com/tools" 
    android:focusableInTouchMode="true" 
    android:padding="8dp" 
    android:background="@drawable/old_map" 
android:layout_height="match_parent"> 

<ScrollView 
    android:layout_below="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:scrollbars="none"> 

<RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="600dp"> 

      <view 
      android:scrollbarSize="6dp" 
      android:id="@+id/recent_post" 
      class="android.support.v7.widget.RecyclerView" 
      android:layout_width="match_parent" 
      android:layout_height="400dp" 
      android:scrollbars="vertical" /> 

      <view 
      android:scrollbarSize="6dp" 
      android:id="@+id/recent_post" 
      class="android.support.v7.widget.RecyclerView" 
      android:layout_width="match_parent" 
      android:layout_height="400dp" 
      android:scrollbars="horizontal" /> 

</RelativeLayout> 
    </ScrollView> 
</RelativeLayout> 
0

我不知道就是你想要什么样的滚动,但它是可以同时使用这两种卷轴:

<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" > 

     <HorizontalScrollView 
      android:id="@+id/HorizontalScrollView02" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" > 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical" > 

       <!-- HERE YOUR CODE--> 
      </LinearLayout> 
     </HorizontalScrollView> 
    </LinearLayout> 
</ScrollView> 
+0

我想在scrollview里面有水平列表 – alphanso

+0

是否可以使用recyler视图 – alphanso

相关问题