【发布时间】:2016-09-27 06:18:21
【问题描述】:
我在CardView 中添加了ImageButton,当我在ImageButton 中添加app:srcComapat 时。我收到如下错误:
错误:(27) 未找到属性“srcCompat”的资源标识符 包'com.example.jaisonjoseph.newsclient'
这是我的 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:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.jaisonjoseph.newsclient.MainActivity"
tools:showIn="@layout/app_bar_main"
style="@style/Base.Widget.AppCompat.ButtonBar"
android:background="#ffffff">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="350dp"
android:layout_height="150dp"
app:cardCornerRadius="6dp"
android:background="#f6f6f6"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/daily"
android:id="@+id/imageButton3"
android:src="@drawable/daily" />
</android.support.v7.widget.CardView>
</RelativeLayout>
【问题讨论】:
-
删除
RelativeLayout中的xmlns:app2行。
标签: android xml resources android-relativelayout android-cardview