- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在尝试使用 drawable-mdpi 文件夹中的 xml 文件将各种图像加载到图像按钮时遇到问题。它适用于一个按钮,但不适用于另一个按钮。该代码适用于第二个图像按钮,但不适用于第一个,我收到错误,
" main.xml: Unable to resolve drawable "C:...workspace\AndroidAlarm\res\drawable-mdpi\keyEntry.xml" in attribute "src".
我在第一个 imageButton 中做的事情与我在第二个 imageButton 中做的完全一样。第二个按钮(工作按钮)的 xml 文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/events_pressed" /> <!-- pressed -->
<item android:drawable="@drawable/events" /> <!-- default -->
</selector>
对于不起作用的那个,它看起来像:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/key_entry_pressed" /> <!-- pressed -->
<item android:drawable="@drawable/key_entry" /> <!-- default -->
</selector>
两者之间的唯一区别是传入的图像。所有图像都位于 drawabl-mdpi 文件夹中。我不明白为什么它适用于第二个图像按钮而不适用于第一个。两个按钮的 xml 代码如下所示:
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageButton
android:id="@+id/imagebutton1"
android:src="@drawable/keyEntry"
android:background = "@android:color/transparent"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:scaleType = "fitXY"
android:layout_marginTop = "50px"
android:layout_marginLeft = "40px"
android:layout_marginRight = "20px"
android:layout_marginBottom = "50px"
android:layout_weight="1"/>
<ImageButton
android:layout_marginTop="50px"
android:layout_width="wrap_content"
android:layout_marginRight="40px"
android:id="@+id/imagebutton2"
android:layout_weight="1"
android:src="@drawable/events"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:layout_marginLeft="20px"
android:layout_marginBottom="50px"
android:scaleType="fitXY">
</ImageButton>
</LinearLayout>
提前致谢!
最佳答案
资源不能包含大写字母:
android:src="@drawable/keyEntry"
提示资源名称应该有错误:
Invalid file name: must contain only [a-z0-9_.]
关于android - 无法解析属性 "src"中的可绘制对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5108850/
我正在尝试使用 jquery 获取图像 src,如下所示: HTML Javascript var imageSrc = $('.post_container img').attr('s
我遇到错误,无法完成构建。我搜索了 Stackoverflow 和 Github。我已经尝试了很多方法,但我无法修复。请帮忙。 (1) 在 [src/nullnull/debug, src/debug
我正在尝试使用图像制作一款类似 Match3 的游戏,但我无法进行比较。我正在为固定数量的 atm 执行此操作,只是为了让它正常工作,稍后应该在 foreach 循环中。如果有什么区别的话,该函数位于
我正在使用 jquery 插件 OwlCarousel,在我的一个 View 中使用 ng-repeat 场景,如下所示: 它运行良好,并为轮播中的每个项目输出以下标记: 有没
我的代码如下所示: Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.image1); int wi
如果未找到 src,我将使用 Angular 指令作为后备 url 作为名称首字母 指令 (function () { 'use strict'; angular .m
我是构建 chrome 扩展的新手,从一个小项目开始,我需要在弹出窗口中打印“构建版本”。构建版本被附加到 JS/CSS 资源中,如下所示: 需要从脚本 src 值中提取“6.0”。你能帮我看看如何
类型‘AbstractControl’上不存在属性‘Controls’。
这个tutorial演示如何使用指令 ngSrc 而不是 src : 他们要求: Replace the ng-src directive with a pl
我正在创建一个包含多个图像的图库,您可以在其中单击一个小缩略图,然后将打开该图像的更大版本。 打开后,如果您移动光标,图像将在 y 轴上跟随您。类似于 https://www.zara.com/es/
文档[] src.charAt src.length 这三样东西是什么? 我确定 pixState 会给我 1 或 0; var pixState = document[imgName].src.ch
问题背景: 我正在使用这个问题的解决方案:How to update AngularJS view when the value has not changed?所以在我看来我有: 当我更改照片时
我在 html 中有整个页面,在输出之前我想将所有 img src 替换为 data-src我正在使用 return (preg_replace('~]*\K(?=src)~i','data-',
Difference(s): android:src and tools:src? 如果有的话,什么时候使用 tools:src 而不是 android:src 是合适的? 最佳答案 如果您在运行时在
我需要检查每个 script 标签的 src 值,如果匹配,我想更改该脚本标签的 src 属性...像这样: var scripts = document.getElementsByTagName("
使用 img 标签的 data-src 或 src 属性有什么区别和后果(好的和坏的)?我可以使用两者获得相同的结果吗?如果是这样,应该什么时候使用它们? 最佳答案 属性 src 和 data-src
我使用 Vue。我尝试输出图像,当我使用 src 时效果很好,但当我使用 :src 时效果不佳。 作品 不起作用 我试过但没有用 @ 在路径的第一个。 ~ 路径中的第一个。 ./ 在路径的第一个。
在当前项目中我正在使用 jQuery。我只是想知道为什么会这样, $('#homeIcon').hover(function(){ document.getElementById('homeI
我在严格的 Java 环境中。 所以这个问题并不像标题中那么简单,我不是要解决我遇到的问题,它更理论化,以获得更好的知识。 我感兴趣的是用双引号或单引号匹配 src,但如果是双引号,它也必须用双引号结
我有一个 Joomla 2.5.28,现在使用 https 而不是 http。 一些文章(很多)包含来自 Vimeo 的嵌入视频。 最初,这些视频是使用http嵌入的,所以现在我的数据库中有字段int
我是一名优秀的程序员,十分优秀!