android - CoordinatorLayout AppBarLayout 背后的内容

标签 android xml android-toolbar android-coordinatorlayout

我正在为我的应用创 build 置 Activity/布局。我有一个带有 AppBarLayoutToolbarCoordinatorLayout,然后在其下方包含 content_settings.xml。加载内容时,.xml 文件位于应用栏后面。

我正在使用相同的设置来加载主要内容,它工作正常,但由于某种原因在“设置”部分中无法正确呈现。

activity_settings.xml

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay" />

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

<include layout="@layout/content_setting" />

content_settings.xml 只是一个 FrameLayout 被替换为 PreferenceFragment

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

enter image description here

最佳答案

将此添加到您的 Recyclerview 中:

app:layout_behavior="@string/appbar_scrolling_view_behavior"

关于android - CoordinatorLayout AppBarLayout 背后的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32855889/

相关文章:

android - 对 Min SDK 版本感到困惑

android - 检索数据时 Phonegap 摄像头故障

java - 我得到 "The Constructor Base64() is not visible error"

c# - 如何在 C# 中从混合 xml/二进制文件的 header 读取 XML 数据

滚动时的Android工具栏提升

java - 如何修复我的 Android 应用程序在启动时不断崩溃且无法打开的错误? (更多详情请参阅说明)

java - 获取包含 "&"特殊字符的数据时遇到问题

javascript - page.xml 中的 Magento skin_js 路径

android - 滚动 RecyclerView 时工具栏隐藏时的布局抖动

Android 支持库 23.2.0 导致工具栏箭头为黑色