- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Android 中的ToolBar 和CollapsingToolBar 有什么区别?我试着在网上找到它,但找不到任何有用的资源
最佳答案
工具栏看起来像这样:
您可以将它移动到屏幕上任何您想要的位置。它就像一个 View 一样对待。
让我们看看如何将它与其他 View 放在自己的布局文件中:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="56dp">
</Toolbar>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/gray"/>
collapsingtoolbar 是一个包装器,用于在工具栏上执行某种动画并将图像等 View 添加到工具栏。这是一个例子:
当您在折叠工具栏上向下滑动时,它会显示其他 View 。
这是一个代码示例,请注意我是如何将工具栏放在可折叠工具栏内的,它将它包裹起来:
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp"
android:fitsSystemWindows="true">
<com.antonioleiva.materializeyourapp.SquareImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
注意:您可能想将它放在协调器布局中,但我不想增加更多困惑。
关于android - ToolBar 和 CollapsingToolBar 之间的主要区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34046328/
我试图在展开或折叠折叠工具栏时显示标题。然而,在任何这些状态下,标题总是有一个移动动画: 如何完全摆脱动画并使标题停留在一个位置? 我试过将 titleEnabled 设置为 false,但这只会禁用
我正在尝试创建一个 CollapsingToolbarLayout,其中有一张电影海报与背景重叠。为了实现这一点,我启用了behavior_overlapTop =“67dp”,但这会导致奇怪的滚动行
我有一个 Navigation Drawer Activity (NavActivity),其中一个 fragment (OuterFrag.xml) 有一个 Collapsing Toolbar 和
我很确定这是一个错误,所以我正在寻求解决方法。我的布局是这样的: 我正在从网
在我的 CountryActivityInfo.java 中,我有一个折叠工具栏,其宽度和高度都设置为 match-parent,因此它可以占据整个手机屏幕。当我向上滚动时,工具栏会获得固定的 200
基本上,我想知道如何在使用 RecyclerView 时,如何实现一种“动画 CollapsingToolbar”。请注意,它用引号引起来,因为我没有附加到 CollapsingToolbar 的解决
我正在使用 android 支持设计 'com.android.support:design:22.2.1' 我的问题是当滚动没有内容时,折叠工具栏仍然启用折叠操作。如果滚动中没有内容,我需要删除 V
简而言之: Is this a collapsing toolbar or a Persistent Bottom Sheet? 起初我认为这是一个折叠工具栏,但在折叠工具栏上向上滚动不是那么平滑,并
我已经遇到过这个问题: MainActivity 的标题隐藏了选项卡。你能告诉我如何改变它的位置吗? Here is an XML code:
我需要知道 Material 设计库中的 CollapsingToolbar 何时折叠。 最佳答案 正如 Marko 所说,这可以使用您自己的 OnOffsetChangedListener 实现来实
如何为 RTL 语言添加一些填充到 collapsingToolbar 标题中,这对 LTR 语言很好,但对 RTL 就像下面这样.. 非常感谢 这是我的布局..正如您在上图右侧看到的那样,标题没有任
这就是我想要实现的,在 CollapsingToolbar 中的图像下方将有一个自定义布局,该布局将包含几个 View 项。 1 所需的行为是,在滚动时,底部布局会逐渐淡化和消失,顶部的图像会缩小并固
Android 中的ToolBar 和CollapsingToolBar 有什么区别?我试着在网上找到它,但找不到任何有用的资源 最佳答案 工具栏看起来像这样: 您可以将它移动到屏幕上任何您想要的位置
正如标题所暗示的,我有一个具有 FrameLayout 的 Activity 那是我的Fragments [我没有使用标签,只是交易]。我还有一个 NavigationDrawer和 Toolbar
我为 TextView 开发了一些自定义行为根据 AppBarLayout 的高度改变位置和大小在 CoordinatorLayout 里面.这样一来,标题就显得很大,并且位于完全展开的 Toolba
我的布局有一个标题部分,标题部分下面有一个图标和文本。在标题下的嵌套 ScrollView 中有更多描述(如下所示)。 当用户滚动查看更多描述时,我希望图标慢慢消失,标题文本保留在原位。但是我不确定该
如何在 Android 的折叠工具栏布局中设置标题和子标题,如 whatsapp 个人资料 View 。 我附上了相同的示例屏幕截图。 最佳答案 我终于得到了答案。请检查链接。这就是我要的。 http
我正在开发一款采用 Material Design 的 Android 应用。我有一个带有 CollapsingToolbarLayout 和 ImageView 的详细 View (到目前为止工作正
我有一个折叠式工具栏布局,如下所示: circle_image_view 在哪里 这只是一个带有圆形 mask 的标准 ImageView 。当
我正在开发像 UBER 这样的应用程序。自定义标记的第一次滚动在 map 上运行良好。之后我像 UBER 一样添加了 NestedScrollView。但是 map 滚动手势与 AppBar 滚动行为
我是一名优秀的程序员,十分优秀!