【问题标题】:Android toolbar PreferenceActivityAndroid 工具栏 PreferenceActivity
【发布时间】:2015-10-21 21:43:34
【问题描述】:

我按照不同的示例将工具栏插入到我的 PreferenceActivity 中。我最终找到了一个结论,但 FrameLayout 与 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_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>

【问题讨论】:

    标签: android frame toolbar


    【解决方案1】:

    你的布局是这样说的。 RelativeLayout 需要被告知工具栏位于框架布局的顶部,或者框架布局位于工具栏的下方。

    所以要么将它添加到框架布局中:

    android:layout_below="@id/toolbar"
    

    或者这个到工具栏:

    android:layout_above="@id/content_frame"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-02
      • 2021-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-06
      相关资源
      最近更新 更多