【发布时间】:2016-11-28 21:14:45
【问题描述】:
基本上我用 CoordinatorLayout 创建了一个 Activity,一切似乎都在工作。但是有 2 个 AppBar。一个是空的(无文本)并显示在活动的顶部。而另一个在协调器布局上表现得应该:最初只是文本,没有背景;当您向上滑动时,它会移动到屏幕顶部,并获得一个背景(如果这听起来令人困惑,请查看动画here。
这是它的外观截图:
我尝试使用:
requestWindowFeature(Window.FEATURE_NO_TITLE);
和
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
但似乎两者都对布局没有任何影响。
这是我的活动 XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="aris.projectaris.InfoPreviewActivity">
<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_info_preview" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
【问题讨论】:
-
hierarchyviewer/ layout inspector 显示什么? -
好吧,它在顶部显示了一个工具栏。我很确定它应该在那里(非空的)。我用我的活动 xml 文件更新了问题
标签: android android-layout android-design-library androiddesignsupport