2016-09-25 3 views
0

내 gridview가 스크롤되지 않습니다. 나는 gridview에서 10 개의 항목을 가지고 있지만 단 6 개의 쇼와 일부 항목은 잘려나갔습니다.nestedscrollview에 포함 된 gridview를 스크롤 할 수 없습니다.

<?xml version="1.0" encoding="utf-8"?> 

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:id="@+id/appbar_layout" 
    android:layout_height="@dimen/app_bar_height" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/collapsing_toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:contentScrim="?attr/colorPrimary" 
     app:expandedTitleMarginStart="@dimen/expanded_toolbar_title_margin_start" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

     <ImageView 
      android:id="@+id/image_view" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scaleType="centerInside" 
      android:src="@drawable/yelp" 
      app:layout_collapseMode="parallax" 
      app:layout_collapseParallaxMultiplier="0.7" /> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      app:layout_collapseMode="pin" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
      app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> 

    </android.support.design.widget.CollapsingToolbarLayout> 

</android.support.design.widget.AppBarLayout> 

<android.support.v4.widget.NestedScrollView 
    android:layout_width="match_parent" 
    android:id="@+id/nestedscrollview" 
    android:layout_height="match_parent" 
    android:fillViewport="true" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

    <RelativeLayout 
     android:id="@+id/gridContainerLayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     > 


     <GridView 
      android:id="@+id/grid" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:columnWidth="100dp" 
      android:gravity="center" 
      android:listSelector="#00000000" 
      android:numColumns="auto_fit" 
      android:stretchMode="columnWidth" 
      /> 

     <ProgressBar 
      android:id="@+id/progressBar1" 
      style="?android:attr/progressBarStyleLarge" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" /> 

    </RelativeLayout> 
</android.support.v4.widget.NestedScrollView> 

여기에 문제의 두 사진입니다 : 여기

이있는 gridview의 레이아웃입니다. 위쪽으로 스크롤하면 옐프 이미지가 표시되지만 gridview에서 중첩 스크롤을하지는 않습니다. 이유는 무엇입니까?

enter image description here

enter image description here

는 UPDATE : 나는 또한이 일을 시도 :

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 
      mGridView.setNestedScrollingEnabled(true); 
     } 

와 IT는 API 롤리팝 작업을 시작. 하지만 오래된 장치에서도 실행해야합니다. 왜 롤리팝 전에 기기에서 스크롤하지 않습니까?

답변

1

RecyclerView를 GridView 대신 GridLayout과 함께 사용할 수 있습니다. 그런 다음 중첩 스크롤을 사용 중지하는 것은 롤리팝 사전 버전에서 수행 할 수 있습니다.

관련 문제