使用Android Studio中,我得到這個錯誤在我的活動佈局:Error:(9) No resource identifier found for attribute 'headerView' in package 'com.merahjambutech.zuki.deteksi'
安卓:未找到屬性資源標識符「headerView」
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
xmlns:compat="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.merahjambutech.zuki.deteksi.view.PullToZoomListViewEx
android:id="@+id/paralax_social_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@android:color/transparent"
app:headerView="@layout/header_parallax_social" />
</LinearLayout>
我很肯定的佈局header_parallax_social.xml可在我的項目文件(RES /佈局),這裏有header_parallax_social代碼:
<?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/android"
android:layout_width="match_parent"
android:layout_height="160dp" >
<ImageView
android:id="@+id/header_parallax_social_new_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:contentDescription="@string/cd_main_image"
android:scaleType="centerCrop"
android:src="@drawable/parallax_social_small" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
</LinearLayout>
</RelativeLayout>
我曾試圖改變的xmlns:應用程序和類似的東西,但仍沒有找到解決方案...
我想你應該使用drawable而不是layout。=>'app:headerView =「@ drawable/header_parallax_social」' –
或者嘗試更改'xmlns:app =「http://schemas.android.com/apk/ RES-auto'到'的xmlns:程序=「HTTP:// schemas.android.com/tools' –