从CollapsingToolbarLayout找不到app:layout_scrollflags的资源ID [英] no resource id found for app:layout_scrollflags from CollapsingToolbarLayout
问题描述
这个问题的标题基本上说明了一切.我得到了错误: 在CollapsingToolbarLayout中找不到app:layout_scrollflags的资源标识符.我使用eclipse并导入了设计库jar文件.我可以在班级中使用设计支持布局,这是正确的
The title of this question basically says it all. I get the error: no resource identifier found for app:layout_scrollflags from CollapsingToolbarLayout. I use eclipse and imported the design library jar file. I'm able to use the design support layouts in my classes so that's correct
这是我使用的一部分代码:
this is a piece of the code i use:
<LinearLayout
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:orientation="vertical"
android:background="@color/activityBg"
tools:context=".MainActivity"
>
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<include
layout="@layout/toolbar"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
示例: http://android-developers.blogspot.in/2015/05/android-design-support-library.html
推荐答案
仅导入设计库jar文件是不够的.您需要导入 android-design-library 项目的资源,而jar文件仅包含类文件.
only importing the design library jar file is not enough. You need to import resource of android-design-library project while the jar file only contains class files.
按我说的做:
- 导入 android-design-library 项目.该项目在 " sdk/extras/android/support/design/".并将其设置为库 项目,如果不是.
- 将上述项目作为库导入到您的主项目中.
- import android-design-library project. The project is at "sdk/extras/android/support/design/". And set it as a library project if it is not.
- import the above project into your main project as a library.
您必须执行此操作,因为xmlns:app="http://schemas.android.com/apk/res-auto"
表示您需要库项目或当前项目中的本地资源,在这种情况下,这意味着您需要来自 android-design-library库项目中的资源.
You have to do this, because xmlns:app="http://schemas.android.com/apk/res-auto"
means your need local resources from your library project or the current project, in this case, it means you need resources from the library project of android-design-library.
这篇关于从CollapsingToolbarLayout找不到app:layout_scrollflags的资源ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!