2015-07-01 10 views
9

से नीचे सफेद स्थान छोड़ देता है मुझे कोई समस्या है। यहाँ स्क्रीनशॉट रहे हैं:CollapsingToolbarLayout कभी-कभी

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/drawerLayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

<android.support.design.widget.CoordinatorLayout 
    android:id="@+id/rootLayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="256dp" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/collapsingToolbarLayout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      app:expandedTitleMarginStart="64dp" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:background="?attr/colorPrimary" 
       android:minHeight="?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:layout_height="match_parent" 
     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"> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Yo Yo" /> 
     </LinearLayout> 

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

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fabBtn2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|right" 
     android:layout_marginBottom="@dimen/codelab_fab_margin_bottom" 
     android:layout_marginRight="@dimen/codelab_fab_margin_right" 
     app:borderWidth="0dp" 
     app:fabSize="normal" /> 

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

<android.support.design.widget.NavigationView 
    android:id="@+id/navigation" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    app:headerLayout="@layout/nav_header" 
    app:itemIconTint="@color/colorPrimaryDark" 
    app:itemTextColor="@color/colorPrimary" 
    app:menu="@menu/navigation_drawer_items" /> 

आप कभी कभी एक सफेद देख सकते हैं,:

enter image description here

enter image description here

enter image description here

और यहाँ कोड है टूलबार के नीचे स्थान दिखाई देता है, लेकिन कभी-कभी नहीं। डू यो को क्या गलत है इसका कोई विचार है? क्योंकि मैं वास्तव में नहीं जानता कि इसे कैसे ठीक किया जाए।

अग्रिम धन्यवाद,

संपादित करें: मैं केवल नेक्सस 7

+0

मैं एंड्रॉयड 5.1.1 –

उत्तर

19

में एंड्रॉयड 5.1.1 के साथ इस पुन: पेश कर सकते हैं this answer में सुझाव दिया, जोड़ने का प्रयास करें:

android:layout_gravity="fill_vertical" 
को

NestedScrollView/RecyclerView

+0

वर्क्स के साथ एक Nexus 6 पर एक ही त्रुटि मिलती है, धन्यवाद आप –

+0

काम करता है .. सही समाधान – sreekumar

+0

मेरे लिए काम करने में विफल। हालांकि मेरे पास निचले हिस्से के व्यवहार के साथ, एक और नेस्टेड कोऑर्डिनेटर लेआउट है। नीचे की शीट में ऐप बार है। समस्या तब उत्पन्न होती है जब डिफ़ॉल्ट रूप से BottomSheet खोला जाता है और ऐप लॉन्च होने पर स्क्रीन चालू होती है। यदि स्क्रीन लॉक है और ऐप लॉन्च किया गया है, तो कोई समस्या नहीं है। – McP

0

जोड़े android:fitsSystemWindows="true" करने के लिए CoordinatorLayout, AppBarLayout और CollapsingToolbarLayout। इस डालने के लिए

+3

यह काम नहीं करता है –

0

कोशिश NestedScrollView में विशेषताओं का सही व्यवहार के लिए मजबूर करने, यह एक समाधान नहीं है और काम करता है मेरे लिए:

android:paddingTop="0dp" 
    android:layout_marginTop="0dp" 
संबंधित मुद्दे