今儿个脑袋又间歇性短路了……
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onclick="click"
android:text="开启接收" />
报错:error: No resource identifier found for attribute 'onclick' in package 'android'
找了半天竟然没找出来,度娘了一下也没有这个问题的解答。去Stackoverflow找了竟然发现自己是如此的脑残。onClick忘大写了。以此文勉之,希望以后不要再犯傻X错了
下面摘录了一下自定义控件时出错的原因,给以后不是犯脑残错的人以参考:
关于android自定义View时报error: No resource identifier found for attribute ‘XXX’ in package ‘
错误原因: xmlns:ptr="http://schemas.android.com/apk/res/com.ycii.newseye.ui"
解决方式:
xmlns:ptr="http://schemas.android.com/apk/res/com.ycii.ljapp.ui",
com.ycii.ljapp.ui为AndroidManifest.xml 中定义的 package,即: <manifestxmlns:android="http://schemas.android.com/apk/res/android"
package="com.ycii.ljapp.ui"
android:versionCode="1"
android:versionName="1.0" >