2017-07-03 95 views
0

我的问题与FrameLayout里的FrameLayout干扰AppBarLayout

的FrameLayout风格干扰AppBarLayout

我想成为下AppBarLayout

problem screenshot

activity_main.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.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="56dp" 
     android:background="?attr/colorPrimary" 
     app:layout_scrollFlags="scroll|enterAlways" 
     app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> 

    <android.support.design.widget.TabLayout 
     android:id="@+id/tabs" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:tabMode="fixed" 
     android:layoutDirection="rtl" 
     app:tabGravity="fill"/> 
</android.support.design.widget.AppBarLayout> 

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

尝试添加这行代码你'FrameLayout'里面:'应用:layout_behavior = “@字符串/ appbar_scrolling_view_behavior”' – Yupi

+0

固定谢谢你,只有新的问题的https://image.ibb。 co/jqv5Sv/Screenshot_2017_07_04_02_24_46.png – user8215914

+0

这不是完整的XML。更新您的activity_main.xml整个xml代码 – Yupi

回答

0

创建FrameLayout像这样:

<?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:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

       <android.support.v7.widget.Toolbar 
        android:id="@+id/toolbar" 
        android:layout_width="match_parent" 
        android:layout_height="56dp" 
        android:background="?attr/colorPrimary" 
        app:layout_scrollFlags="scroll|enterAlways" 
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> 

       <android.support.design.widget.TabLayout 
        android:id="@+id/tabs" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        app:tabMode="fixed" 
        android:layoutDirection="rtl" 
        app:tabGravity="fill"/> 
      </android.support.design.widget.AppBarLayout> 

      <FrameLayout 
       android:id="@+id/frame_container" 
       app:layout_behavior="@string/appbar_scrolling_view_behavior" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" /> 
      </android.support.design.widget.CoordinatorLayout>