The*_*mad 5 android android-toolbar android-coordinatorlayout
我有CoordinatorLayout,Toolbar,DrawerLayout,和FrameLayout我的基地Activity布局,但我有一些重叠的麻烦Toolbar.我插入不同Fragments的FrameLayout.
活动布局
<?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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:theme="@style/ToolbarOverlay"
android:popupTheme="@style/ToolbarOverlay"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:minHeight="?attr/actionBarSize"
android:elevation="10dp"/>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="com.walintukai.lovelupdating.widgets.SnackbarBehavior"/>
</android.support.design.widget.CoordinatorLayout>
<ListView
android:id="@+id/navigation_drawer"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#80858585"
android:dividerHeight="1dp"
android:listSelector="@android:color/transparent"
android:background="#bf333333"/>
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)
当我运行它时,我Toolbar正在重叠它的内容FrameLayout并且在它的顶部,当我希望它像LinearLayout一样在它下面.
如何调整它以使其内容FrameLayout位于下方Toolbar并且不会重叠?
更新1:
我已经测试了使用它app:layout_behavior="@string/appbar_scrolling_view_behavior"作为行为FrameLayout,它给了我预期的行为Toolbar,但随后它删除了Snackbar推送行为.如何将两种行为结合在一起?
我尝试过扩展ScrollingViewBehavior和组合这两种行为,但是当Snackbar显示时,它仍然会在工具栏下推动布局.如果我解雇Snackbar,一切看起来都很好.
| 归档时间: |
|
| 查看次数: |
350 次 |
| 最近记录: |