我正在为我的应用创 build 置 Activity/布局。我有一个带有 AppBarLayout
和 Toolbar
的 CoordinatorLayout
,然后在其下方包含 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" />
最佳答案
将此添加到您的 Recyclerview 中:
app:layout_behavior="@string/appbar_scrolling_view_behavior"
关于android - CoordinatorLayout AppBarLayout 背后的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32855889/