我正在为我的应用程序创建一个设置活动/布局。我有一个带有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" />