2016-12-27 88 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