- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我尝试更改 Activity 的 XML 文件中的 android:background
时遇到了这个问题。
Information:Gradle tasks [:app:assembleDebug]
C:\Users\Valentin\AndroidStudioProjects\CedarRestaurants4\CedarRestaurants3\app\src\main\res\layout\activity_dynamic_view_ordering.xml
Error:error: 'drawable/delete' is incompatible with attribute android:background (attr) reference|color.
Error:'drawable/delete' is incompatible with attribute android:background (attr) reference|color.
Error:failed linking file resources.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Information:BUILD FAILED in 4s
Information:7 errors
Information:0 warnings
Information:See complete output in console
我的 Activity 的 XML 文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parent_linear_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:orientation="vertical" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal" >
<EditText
android:id="@+id/number_edit_text"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5" />
<Button
android:id="@+id/delete_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="drawable/delete.png"
android:onClick="onDelete" />
</LinearLayout>
<Button
android:id="@+id/add_field_button"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#555"
android:layout_gravity="center"
android:onClick="onAddField"
android:textColor="#FFF"
android:text="New"
android:paddingLeft="5dp"/>
</LinearLayout>
<Button
android:id="@+id/placeOrderButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/parent_linear_layout"
android:layout_centerHorizontal="true"
android:layout_marginBottom="250sp"
android:text="@string/place_order"
android:textSize="32sp" />
</RelativeLayout>
我从教程项目中复制了 Activity 布局文件和 Activity ,并尝试将图像资源更改为更现代的东西。
我已经确保我的 delete.png
位于 /src/main/res/drawable
中,并且已经尝试在最后删除 .png,但没有运气。感谢您的帮助。
最佳答案
您忘记将 @
添加到您的 drawable
并删除 extention
。所以改变你的
android:background="drawable/delete.png"
到这个
android:src="@drawable/delete"
关于android - 错误 :error: 'drawable/delete.png' is incompatible with attribute android:background (attr) reference|color,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54880183/
我只是想知道下面的$(*[attr])和$([attr])中哪一个更可取。为什么? 因为两者都在做同样的事情。 $('[onclick]').each(function(i,elem){ cons
长期以来我一直在尝试找出问题所在,但不幸的是无法 如果我这样做 android.enableAapt2=true 代码工作正常,但是删除相同的(应该是强制性的)会抛出一个错误说 \incrementa
使用此代码: $('#ipadmenu section').attr('data-order', hash) 我将 data-order 属性设置为“hash”的值。如何选择具有该属性/值的元素而不是
我有一个用于扩展的组合框监听器。展开后,它会对组合框选项中具有特定类的每个元素执行一些样式设置。所需的更改之一是根据当前属性的值更改属性。使用 this 返回未定义。 expand : funct
性能上有区别吗 :not([attr="value"]) 和 [attr!="value"] ? CSS3 规范是否推荐了一种替代方案? 编辑: CSS3 规范不包含 [attr!="value"]
所以我有一个叫做 say,mySave 的指令,它几乎就是这个 app.directive('mySave', function($http) { return function(scope,
有人可以告诉我有什么区别吗 ?android:attr/colorPrimary 和 ?attr/colorPrimary 无论我使用哪个,结果都是一样的。尽管第一个选项导致android.view.
Xpath问题: 何时使用@和属性,何时不使用。有关系吗?有什么区别 最佳答案 使用//tag[attr]时,将选择所有具有至少一个名为tag的子元素的attr元素。另一方面,使用//tag[@att
android布局xml文件中的?android:attr/和?attr/有什么区别?在不同的情况下我们应该使用哪一个? 最佳答案 1。 ?attr/ 定义并引用您在应用程序中自行定义的属性的值。 2
如果 obj 不存在 obj? 生成一个 nil 所以 obj?.attr 也是。 如果 obj 为 nil,则 obj!.attr 崩溃。 但是如果我确定 obj 在代码的某个点总是存在,那么对我来
有一个这样的 HTML。 Back 1 2 3 Next 为了获得最大的页数,我写了这篇文章。 doc = Nokogiri::HTML(html) doc.xpath('//
我想知道这些标签在 android xml 中如何工作。例如在造型方面 style="?android:attr/buttonBarButtonStyle" 和 style="@android:att
这是我的代码: $("input[name=donationmode]").change(function() { $(".setpaymentOptions").children().add
我已经搜索了一段时间,但没有找到我正在搜索的内容。 事情是这样的,我有两张表,我们称它们为表 A 和 B。当 A 更新时,我需要更新 B 中的属性。例如:A. 电子邮件和 B. 电子邮件。当用户在 A
大家好,在访问一个循环的 php 变量时遇到了一个小问题。我的脚本循环使用来自 mysql 数据库的 x 和 y。它还循环出我无法访问的 id,它显示为未定义。我正在使用鼠标移开功能来检测已循环的每个
我将自己的标签转换为输入。我可以使用 select 为输入选择只读/禁用。我做到了。有用。但不是在 ie8 )). 我阅读了 Angular 和 IE8 的官方文档。我添加了它。但是我的应用程序在 i
我正在使用令人惊叹的 attrs 库以一种非常优雅的方式定义许多对象属性,到目前为止它一直运行得非常棒。 我目前遇到的唯一问题是,有时我想通过引用其他 attr.ib() 属性来定义默认值。如果 na
我注意到 javascript 有几种方法来设置和获取元素的属性。 我不确定它们之间有什么区别。特别是,是否存在跨浏览器问题。 最佳答案 DOM 元素的特性和属性有很大不同,这种差异是一些混淆的根源。
在 4.x 设备上,使用 ?android:attr/selectableItemBackgroundBorderless 的布局文件会导致崩溃,但 ?attr/selectableItemBackg
.attr('disabled', 'disabled') 和 .attr('disabled', true) 在我的代码中都有效,但我只是想知道:两者中哪一个更有效和/或哪一个更常用?真的有区别吗?
我是一名优秀的程序员,十分优秀!