gpt4 book ai didi

android - 错误 : attribute 'package:contentScrim' not found

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:35:05 24 4
gpt4 key购买 nike

当我尝试进行折叠工具栏布局时,我收到有关未找到 contentScrim 的错误。 这是我的 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"
android:id="@+id/htab_maincontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

<android.support.design.widget.AppBarLayout
android:id="@+id/htab_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/htab_collapse_toolbar"
android:layout_width="match_parent"
android:layout_height="256dp"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:titleEnabled="false">

<ImageView
android:id="@+id/htab_header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/header"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"/>

<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.3"
android:background="@android:color/black"
android:fitsSystemWindows="true"/>

<android.support.v7.widget.Toolbar
android:id="@+id/htab_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="top"
android:layout_marginBottom="48dp"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

<android.support.design.widget.TabLayout
android:id="@+id/htab_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:tabIndicatorColor="@android:color/white"
app:tabSelectedTextColor="@android:color/white"
app:tabTextColor="@color/white_70"/>

</android.support.design.widget.CollapsingToolbarLayout>

</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
android:id="@+id/htab_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

</android.support.design.widget.CoordinatorLayout>

我在 GitHub 和其他网站上看过所有教程。并使用但我无法得到解决方案。 fragment 的视差粘性 header 的任何简单方法。现在我正在遵循 https://android.jlelse.eu/parallax-scrolling-header-tabs-android-tutorial-2cc6e40aa257 的代码并查看 android 开发人员关于 CollapsingToolbarLayout 的文档。

最佳答案

我不知道您为什么会收到该错误,但这可能是一个好的开始。

https://stackoverflow.com/a/31180719/7900721

否则,我发现了这个关于掌握协调器布局的非常好的教程,它有一个 github 存储库,其中有很多很好的例子,以及在我开发一个时帮助我的折叠工具栏布局。

http://saulmm.github.io/mastering-coordinator

关于android - 错误 : attribute 'package:contentScrim' not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48091933/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com