错误:(34)在'com.hackerinside.jaisonjoseph.radioplanet'包中找不到属性'srcCompat'的资源标识符(Error:(34) No resource identifier found for attribute 'srcCompat' in package 'com.hackerinside.jaisonjoseph.radioplanet')
当我向卡片视图添加图像时,我发现错误如错误:(34)找不到包'com.hackerinside.jaisonjoseph.radioplanet'中属性'srcCompat'的资源标识符
这是我的content_main.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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:id="@+id/Relative" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/holo_blue_dark" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="com.hackerinside.jaisonjoseph.radioplanet.MainActivity" tools:showIn="@layout/activity_main"> <Button android:text="Button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /> <android.support.v7.widget.CardView android:layout_width="350dp" android:layout_height="200dp" app:cardElevation="10dp" android:id="@+id/card" android:layout_above="@+id/button" android:layout_centerHorizontal="true" android:layout_marginBottom="15dp" android:layout_marginTop="20dp"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" app:srcCompat="@mipmap/ic_launcher" android:id="@+id/imageView" /> </android.support.v7.widget.CardView>
when i add an image to the card view i am geting error like Error:(34) No resource identifier found for attribute 'srcCompat' in package 'com.hackerinside.jaisonjoseph.radioplanet'
this is my content_main.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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:id="@+id/Relative" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/holo_blue_dark" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="com.hackerinside.jaisonjoseph.radioplanet.MainActivity" tools:showIn="@layout/activity_main"> <Button android:text="Button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /> <android.support.v7.widget.CardView android:layout_width="350dp" android:layout_height="200dp" app:cardElevation="10dp" android:id="@+id/card" android:layout_above="@+id/button" android:layout_centerHorizontal="true" android:layout_marginBottom="15dp" android:layout_marginTop="20dp"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" app:srcCompat="@mipmap/ic_launcher" android:id="@+id/imageView" /> </android.support.v7.widget.CardView>
原文:
最满意答案
特定
list1 = [[objid:1, name:"One"], [objid:2, name:"Two"]] list2 = [[objid:2, name:"Hello"]]
为了获得list1条目,其中匹配来自list2的objids的条目被过滤掉,将需要减去的id收集到一个集合中,然后构造一个谓词,测试给定对象的id是否不在该集合中:
ids = list2.collect { it['objid'] } as Set list3 = list1.findAll { !ids.contains(it['objid']) }
(使用一个集合而不是一个列表应该使查找更快。)
结果是list3包含:
[[objid:1, name:One]]
Given
list1 = [[objid:1, name:"One"], [objid:2, name:"Two"]] list2 = [[objid:2, name:"Hello"]]
In order to get list1 entries with entries matching objids from list2 filtered out, collect the ids that need to be subtracted into a set, then construct a predicate that tests that the id of the given object isn't in that set:
ids = list2.collect { it['objid'] } as Set list3 = list1.findAll { !ids.contains(it['objid']) }
(Using a set instead of a list should make the lookups faster.)
The result is that list3 contains:
[[objid:1, name:One]]
相关问答
更多-
从另一个减去通用列表(Subtract a generic list from another)[2024-03-07]
var result = firms.Except(trackedFirms); // returns all the firms except those in trackedFirms var result = firms.Except(trackedFirms); // returns all the firms except those in trackedFirms -
在zip使用列表理解: C = [[a-b for a, b in zip(sublist, B)] for sublist in A] 或者,使用enumerate的列表理解: C = [[j-B[i] for i, j in enumerate(sublist)] for sublist in A] 使用第三方库NumPy,您可以利用广播来输出数组: import numpy as np A = np.array([[1,2,3],[4,5,6],[7,8,9]]) B = np.array([1 ...
-
列表理解。 a[:] = [x - 13 for x in a] With a list comprehension. a[:] = [x - 13 for x in a]
-
使用map和operator以及itertools.islice ,这样就可以避免中间列表创建或内存开销,还可以避免使用python native for循环: import operator from itertools import islice list_1 = [1,2,5,7,9,85] result = list(map(operator.sub, islice(list_1, 1, None),list_1)) 这里有一个实例 Using map and operator and iter ...
-
在Groovy中从另一个中减去一个对象列表的最佳方法是什么?(What is the best way to subtract one list of objects from another in Groovy?)[2024-01-25]
你应该能够做到: @groovy.transform.EqualsAndHashCode class Item1 { int foo Item1(int too) { this.foo = too } } def list1 = [new Item1(10), new Item1(11), new Item1(13)] def list2 = [new Item1(11), new Item1(12), new Item1(14)] def foos = (lis ... -
使用numpy包 import numpy as np np.prod(np.array(p)-1) 或者使用内置的python,例如运算符 reduce(operator.mul,\ map(lambda el:el-1,\ p),\ 1) Using the numpy package import numpy as np np.prod(np.array(p)-1) Or using a python built-in one, e.g. op ...
-
Nhibernate多表与特定表有一对多的关系(Nhibernate Multiple table have One to many relation to specific table)[2024-04-19]
通常,有更多方法来处理这种情况 - 每种方法都需要进行一些调整/扩展。 也就是说,无论如何你必须改变你的数据库结构 如果A的实例可以被B,C,D中的每一个引用,那么唯一的方法是引入外键列BObjectId,CObjectId,DObjectId。 如果A的实例可以由其中一个(B,C,D)专用,我们需要新的列,我们称之为Discriminator< ... -
如果你想从list1减去list2 (即加上list1和list2 ): var result = list1 .Concat(list2 .Select(pair => new KeyValuePair
(pair.Key, -pair.Value))) .GroupBy(pair => pair.Key, pair => pair.Value) .Select(chunk => new KeyV ... -
你可以这样做: listOfLists = [ [x[0]-15, x[1]] for x in listOfLists] You could do it like this: listOfLists = [ [x[0]-15, x[1]] for x in listOfLists]
-
通过objid减去List(subtract List by objid)[2023-07-31]
特定 list1 = [[objid:1, name:"One"], [objid:2, name:"Two"]] list2 = [[objid:2, name:"Hello"]] 为了获得list1条目,其中匹配来自list2的objids的条目被过滤掉,将需要减去的id收集到一个集合中,然后构造一个谓词,测试给定对象的id是否不在该集合中: ids = list2.collect { it['objid'] } as Set list3 = list1.findAll { !ids.contains ...