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