2016-12-27 134 views
-4

我有这个嵌套的滚动视图,其中我已经在我的xml回收视图。Android嵌套滚动视图

<android.support.v4.widget.NestedScrollView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="50dp" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

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

      <android.support.v7.widget.CardView 
       android:id="@+id/cardView1" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:background="#eaeaea" 
       app:cardElevation="0dp" 
       android:layout_margin="13dp"> 

       <android.support.v7.widget.RecyclerView 
        android:id="@+id/rvcategories" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:clipToPadding="false" 
        android:scrollbars="vertical" 

        /> 
      </android.support.v7.widget.CardView> 

但它与scroll.I在屏幕上采用一排只有3个项目想是有在向用户显示在屏幕上的列表中它需要尽可能多的项目。 我只是想整个屏幕应该与屏幕上的所有列表项目不在屏幕上滚动。

+0

我不明白“我只是想要整个屏幕应该与屏幕上的所有列表项目在屏幕上呈现,而不滚动,,” – Raghunandan

+0

你可以去分段ListView,它可以有多个视图类型需求。如果您想根据屏幕大小调整视图,请根据屏幕大小给出您的项目大小。 – Rahul

+0

你可以添加您试图创建的视图的图示表示 –

回答

0

做这样的事情。

<ScrollView> 
    <LinearLayout> 
    <TextView/> 
    . 
    . 
    .  
    </LinearLayout> 
</ScrollView> 

使用LinearLayout添加多个项目。 ScrollView不会影响视图内部的尺寸。您可以根据需要添加尽可能多的视图,而无需担心屏幕大小或视图大小。

+0

它不起作用@dev – neha

+0

张贴您最新的xml代码 – Dev