Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android工具栏首选项活动_Android_Frame_Toolbar - Fatal编程技术网

Android工具栏首选项活动

Android工具栏首选项活动,android,frame,toolbar,Android,Frame,Toolbar,我按照不同的示例在我的首选项活动中插入工具栏。我最终得出了一个结论,但框架布局与工具栏重叠,如图所示。 这是XML文件 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_p

我按照不同的示例在我的首选项活动中插入工具栏。我最终得出了一个结论,但框架布局与工具栏重叠,如图所示。 这是XML文件

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimary"
    app:theme="@style/ToolbarColoredBackArrow"
    app:popupTheme="@style/MyDarkToolbarStyle"/>

<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="false"
    android:layout_below="@+id/toolbar" />
</RelativeLayout>
你的布局是这样的。 需要告知RelativeLayout工具栏位于framelayout顶部,或者告知framelayout位于工具栏下方

因此,要么将其添加到framelayout:

android:layout_below="@id/toolbar"
或将此选项添加到工具栏:

android:layout_above="@id/content_frame"