2016-05-26 5 views
0

私のレイアウトには奇妙なバグがあり、わかりません。私のフラグメントとTabLayoutの間に白いバーが表示されます。私はこのコードをしばらく変更していませんでした。おそらく、Android 6.0.1(Nexus 5を手に入れました)のものです。 6.0やLollipopにバグがないことは確かです。ここでTabLayoutとフラグメントの間に奇妙な白いバーが表示される

はスクリーンショットです:

enter image description here

これは私の活動XMLれる:

<?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.v4.view.ViewPager 
     android:id="@+id/pager" 
     android:layout_below="@+id/tablayout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"/> 
    <android.support.design.widget.AppBarLayout 
     android:id="@+id/app_bar_layout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     android:fitsSystemWindows="true"> 
     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/collapsing_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="142dp" 
      android:fitsSystemWindows="true" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed" 
      app:contentScrim="?attr/colorPrimary" 
      app:expandedTitleMarginStart="48dp" 
      app:expandedTitleMarginBottom="20dp" 
      app:expandedTitleMarginEnd="48dp" 
      app:expandedTitleTextAppearance="@style/ExpandedText" 
      app:collapsedTitleTextAppearance="@style/CollapsedText"> 
      <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" 
       android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
       app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
       app:layout_collapseMode="pin"/> 
      </android.support.design.widget.CollapsingToolbarLayout> 
     <android.support.design.widget.TabLayout 
      android:id="@+id/tablayout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/toolbar" 
      android:minHeight="?attr/actionBarSize" 
      android:gravity="bottom" 
      android:background="?attr/colorPrimary" 
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
      app:tabIndicatorColor="?attr/colorPrimaryDark"/> 
     </android.support.design.widget.AppBarLayout> 
    </android.support.design.widget.CoordinatorLayout> 

任意のアイデア?

UPDATE 1:

@Abanoub Samaanの提案した後、私のレイアウトは次のようになります。

enter image description here

UPDATE 2:

バグはまた私に表示されますAndroid 5.1.1 Lollipopを実行しているNexus 7(2012)

答えて

0

でそれを置き換えるCollapsingToolbarLayout

android:layout_height="142dp" 

の高さを設定しないでください。

私はバックのようなサポートライブラリの古いバージョンへの変更:今、私のレイアウトが正常に戻っている

compile 'com.android.support:appcompat-v7:23.0.1' 
compile 'com.android.support:design:23.0.1' 

enter image description here

2

私はそれを考え出した

android:layout_height="wrap_content" 
+0

を働いていたそれは仕事、私の質問にアップデートを見ていません。 – zkminusck

+0

TabLayoutの高さを "?attr/actionBarSize"に設定して、 "wrap_content"にしないようにしてください。 –

+0

現在、ツールバーの高さは "?attr/actionBarSize"に設定されています。 – zkminusck

0

私は違う状況でした。そこにいる誰かが役に立つと思うように、私はここでそれを共有します。

DrawerLayout 
    |_ CoordinatorLayout 
     |_ Toolbar 
     |_ FrameLayout 

私はRelativeLayoutでCoordinatorLayoutを変更TabLayoutの下に表示された奇妙なスペースを修正するには、次のようactivity_main.xmlで

私の構造でした。

0

Abdelalimのように、私は別の状況で同じ問題を抱えていました。

私はでframeLayoutでレンダリングされているいくつかの断片を持っていた私は

<RelativeLayout> 
    <FragmenLayout></FrameLayout> 
    <android.support.design.widget.BottomNavigationView><android.support.design.widget.BottomNavigationView 
</RelativeLayout> 

を持っていた私の主な活動で

。私は

android:fitsSystemWindows="true" 

でCoordinatorLayoutを持っていた断片の一つで、私はちょうどそれを取り出して、それが

関連する問題