【Android错误集锦】Content behind CoordinatorLayout AppBarLayout

简介:

在使用Android Studio自动生成的布局的ToolBar时,发现自己的content_main.xml 最上面的item被toolbar遮住了

问题如下图所示:

6be4cc05d4b391c2992bb8416ba98406d8b6e664


解决方案:在content_main.xml的布局中加入:app:layout_behavior="@string/appbar_scrolling_view_behavior"


<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.iwm.qa.mdm.view.MainActivity"
    tools:showIn="@layout/app_bar_main">

    <android.support.v7.widget.RecyclerView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/recycler_view"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" />

</android.support.constraint.ConstraintLayout>

参考: https://stackoverflow.com/questions/32855889/content-behind-coordinatorlayout-appbarlayout


目录
相关文章
|
4月前
|
XML Java Android开发
Android Studio开发之使用内容组件Content获取通讯信息讲解及实战(附源码 包括添加手机联系人和发短信)
Android Studio开发之使用内容组件Content获取通讯信息讲解及实战(附源码 包括添加手机联系人和发短信)
75 0
|
Android开发
Android调用相机时找不到android.support.v4.content.FileProvider unresolved package 'content'
Android调用相机时找不到android.support.v4.content.FileProvider unresolved package 'content'
|
编解码 Java 测试技术
【Android 应用开发】Android 开发错误集锦(三)
【Android 应用开发】Android 开发错误集锦(三)
80 0
|
网络协议 Shell API
【Android 应用开发】Android 开发错误集锦(一)
【Android 应用开发】Android 开发错误集锦(一)
138 0