- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我收到 Error:(26) No resource identifier found for attribute 'srcCompat' in package 'learnapp.android.example.com.learnapp'
当我尝试运行我的应用程序时。我今天刚开始学习 android。我添加了一个新 Activity 并试图更改任何 xml 文件中的任何内容。
这是确切的错误:
Documents/MyProjects/LearnApp/app/src/main/res/layout/activity_display_message.xml
Error:(26) No resource identifier found for attribute 'srcCompat' in package 'learnapp.android.example.com.learnapp'
这是我的 activity_display_message.xml
<?xml version="1.0" encoding="utf-8"?>
<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:fitsSystemWindows="true"
tools:context="learnapp.android.example.com.learnapp.DisplayMessageActivity">
<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_display_message" />
<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" />
</LinearLayout>
我已经阅读了类似的问题,并且看到了这行
xmlns:app="http://schemas.android.com/apk/res-auto"
或
app:srcCompat="@android:drawable/ic_dialog_email" />
他们的情况是错误的,而我的情况不是。
如果重要的话,这个 Activity 的父 Activity 是 MainActivity.java
最佳答案
我只是变了
xmlns:app="http://schemas.android.com/apk/res-auto"
到
xmlns:app="http://schemas.android.com/apk/lib/my_package_name"
我看到了答案here
关于android - 在包 'srcCompat' 中找不到属性 'learnapp.android.example.com.learnapp' 的资源标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38161864/
我制作了自己的 progressBar,这样我就可以在 pre-lolipop 中着色,并且在我将可绘制对象从 png 更改为 vector 之前效果很好。我收到长堆栈跟踪错误。正如我在谷歌上搜索的那
最后 Android studio 得到问题: Error:(11) No resource identifier found for attribute 'srcCompat' in package
我正在向库项目添加矢量可绘制支持,并使用 app:srcCompat 来引用矢量可绘制。似乎唯一有效的 View 是 ImageButton,我不确定为什么。 这是我的 build.gradle 的相
我使用带有 XML 设置图标的 float 操作按钮 app:srcCompat="@mipmap/my_image" 我想使用 java,以便如果某个条件为真,FAB 的图标可以更改为类似 my_i
我正在使用 Support Lib v23.2 中的新矢量可绘制对象支持和 app:srcCompat 并尝试通过数据绑定(bind)设置其可绘制对象。
我正在使用支持库在 android kitkat 上显示矢量图像。当我在模拟器上测试我的应用程序时,我看不到任何这些图像。我为 android lollipop 及更高版本做了一个单独的布局,它运行良
在我的 .xml 布局中使用带有矢量可绘制对象的 app:srcCompat 时,我无法在运行 android 4.2.1 的设备上运行代码。例如我有一个像这样的 FAB: 其中 ic_add 是矢
每次我尝试构建或生成签名的 APK 时,我都会收到上述错误。这question类似,但尚未提出可行的解决方案。 我的 BUILD.GRADLE 依赖项的快照: 我的错误日志快照: 支持库已更新 [ ]
我有一个自定义的 ImageView,我正在为其动态绘制背景,例如: @Override protected void onDraw(Canvas canvas){ p.setColor(Sk
我在 RelativeLayout 中有一个 ImageView。 ImageView 的背景是空的,srcCompat 链接到我在可绘制文件夹中的图像。在布局预览中,一切看起来都很好,但是当我在模拟
我在 @drawable 文件夹中使用复制+粘贴添加了 2 张图像,但出现错误 Error:(25) No resource identifier found for attribute 'srcC
我的问题是,有两个显示本地镜像的按钮,但它不呈现,关于在这里做什么有什么想法吗?? ListView 中项目的 XML 文件:
更新到 Studio 2.3 后,当我尝试使用可绘制矢量创建图层列表时,它会提示在 中使用 app:srcCompat 而不是 android:src位图. 谁能帮我把vector drawable添
我在 stackoverflow 上读到关于 app:srcCompat 的信息并且还从其他资源中得知此属性的主要目的是支持矢量绘图。但是当 android:src 也可以很好地使用 vector-d
我在 stackoverflow 上读到关于 app:srcCompat 的信息并且还从其他资源中得知此属性的主要目的是支持矢量绘图。但是当 android:src 也可以很好地使用 vector-d
我要说的是,我已经在 stackoverflow 上看到了这个问题的一些答案,但只是提供了一个快速的“修复”解决方案。如果可能的话,我也想了解为什么会发生这种情况(有一些细节的回答)。 现在开始讨论这
我编写了一个可以发布推文的应用程序,您可以使用它查看用户时间线和搜索时间线。我使用 TwitterAPI 和 Fabric.io 做到了这一点。如果我想生成 APK 文件或同步 Gradle文件,我收
我正在使用设计支持库 23.2。我在 build.gradle 中添加了这些行,因为我的 Gradle 插件是 1.5 版 defaultConfig { applicationId
我遇到了与 VectorDrawables 的新向后兼容性问题。在支持库 23.2 中,引入了向后兼容 Android VectorDrawables 的新功能。 我有一个分配给 SelectorDr
更新为使用 23.3.1 支持库后,布局编辑器不会使用 app:srcCompat 属性渲染 imageView。 Looks like this in the L
我是一名优秀的程序员,十分优秀!