2015-12-04 23 views
5

मेरे पास एक लेआउट है जिसमें लेआउट में ग्रिड व्यू के साथ एक ढहने योग्य छवि दृश्य है, और यूआई में कई और चीजें हैं। लेकिन स्क्रीन छवि स्क्रॉल तक स्क्रॉल कर रही है, यह तब तक स्क्रॉल हो जाती है जब तक हेडर छवि दिखाई न दे। उसके बाद यह न तो स्क्रॉल करता है।नेस्टेड स्क्रॉलव्यू + रीसाइक्लर देखें

मैं इसे कैसे हल कर सकता हूं?

जनक लेआउट::

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    > 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appBar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:fitsSystemWindows="true" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/collapse_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="256dp" 
      android:fitsSystemWindows="true" 
      app:contentScrim="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

      <ImageView 
       android:id="@+id/headerImage" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:fitsSystemWindows="true" 
       android:scaleType="centerCrop" 
       android:src="@drawable/gallery_shop" 
       app:layout_collapseMode="parallax" /> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:gravity="top" 
       android:minHeight="?attr/actionBarSize" 
       app:layout_collapseMode="pin" 
       app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
       app:titleMarginTop="15dp" /> 

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

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


    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fabCall" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="@dimen/fab_margin" 
     app:layout_anchor="@id/appBar" 
     android:clickable="true" 
     app:layout_anchorGravity="bottom|right|end" 
     android:src="@drawable/telephone_call" /> 

    <include 
     layout="@layout/content_shop_products_category"/> 

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

शामिल लेआउट:

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

<android.support.v4.widget.NestedScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="fill_vertical" 
    android:layout_margin="5dp" 
    android:fillViewport="true" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

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

     <android.support.v7.widget.CardView 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:card_view="http://schemas.android.com/apk/res-auto" 
      android:id="@+id/cardlist_item" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="10dp" 
      android:foreground="?android:attr/selectableItemBackground" 
      android:orientation="vertical" 
      card_view:cardElevation="2dp"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:gravity="center" 
       android:orientation="vertical" 
       android:padding="10dp"> 

       <TextView 
        android:id="@+id/tvAboutShop" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginBottom="5dp" 
        android:textColor="@color/dark_slate_gray" 
        android:textSize="16dp" 
        android:text="About Us" 
        android:textStyle="bold"/> 

       <TextView 
        android:id="@+id/tvAboutShopDesc" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:gravity="center" 
        android:layout_marginBottom="5dp" 
        android:textColor="@color/dark_slate_gray" 
        android:textSize="15dp" 
        android:text="Raju Bakery Store is number one store in the market of Gurgaon. We have all variety of Bakery Items in the city. Special arrangements for marriages and parties" 
        /> 

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

     <android.support.v7.widget.CardView 
      xmlns:card_view="http://schemas.android.com/apk/res-auto" 
      android:id="@+id/cardlist_item1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:foreground="?android:attr/selectableItemBackground" 
      android:orientation="vertical" 
      card_view:cardElevation="2dp"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="vertical" 
       android:padding="10dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textColor="@color/dark_slate_gray" 
        android:textStyle="bold" 
        android:textSize="16dp" 
        android:layout_marginBottom="10dp" 
        android:text="List of Products"/> 

       <GridView 
        android:id="@+id/productsGridView" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:focusableInTouchMode="false" 
        android:horizontalSpacing="10dp" 
        android:listSelector="@android:color/transparent" 
        android:numColumns="2" 
        android:verticalSpacing="14dp"> 

       </GridView> 
      </LinearLayout> 

     </android.support.v7.widget.CardView> 
     <android.support.v7.widget.CardView 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:card_view="http://schemas.android.com/apk/res-auto" 
      android:id="@+id/cardlist_item2" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="10dp" 
      android:foreground="?android:attr/selectableItemBackground" 
      android:orientation="vertical" 
      card_view:cardElevation="2dp"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:gravity="center" 
       android:orientation="vertical" 
       android:padding="10dp"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginBottom="5dp" 
        android:textColor="@color/dark_slate_gray" 
        android:textSize="16dp" 
        android:text="About Us" 
        android:textStyle="bold"/> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:gravity="center" 
        android:layout_marginBottom="5dp" 
        android:textColor="@color/dark_slate_gray" 
        android:textSize="15dp" 
        android:text="Raju Bakery Store is number one store in the market of Gurgaon. We have all variety of Bakery Items in the city. Special arrangements for marriages and parties" 
        /> 

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

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

Expanded layout

Collapsed Layout

उत्तर

1

यहाँ मेरी लेआउट हैंऐसा करने के लिए कोड में हर जगह से android:fitsSystemWindows="true" लाइन हटाएं (आपने 3 बार उपयोग किया था)।

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 

> 

<android.support.design.widget.AppBarLayout 
    android:id="@+id/appBar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:fitsSystemWindows="true" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/collapse_toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="256dp" 

     app:contentScrim="?attr/colorPrimary" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

     <ImageView 
      android:id="@+id/headerImage" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 

      android:scaleType="centerCrop" 
      android:src="@drawable/gallery_shop" 
      app:layout_collapseMode="parallax" /> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:gravity="top" 
      android:minHeight="?attr/actionBarSize" 
      app:layout_collapseMode="pin" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
      app:titleMarginTop="15dp" /> 


</android.support.design.widget.AppBarLayout> 
<include 
    layout="@layout/content_shop_products_category"/> 
    </android.support.design.widget.CollapsingToolbarLayout> 

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fabCall" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_margin="@dimen/fab_margin" 
    app:layout_anchor="@id/appBar" 
    android:clickable="true" 
    app:layout_anchorGravity="bottom|right|end" 
    android:src="@drawable/telephone_call" /> 

</android.support.design.widget.CoordinatorLayout> 
संबंधित मुद्दे