我希望做一个自定义的BUTTON,首先在attrs.xml中定义了
<declare-styleable name="MyButton">
<attr name="who" format="string" />
</declare-styleable>多加了一个who属性然后在main.xml中,
加命名空间了xmlns:t=" http://schemas.android.com/apk/res/com.limaoyuan.button"然后在定义Button的地方
<com.limaoyuan.button.MyButton
t:who="aaad"/>
报No resource identifier found for attribute 'who' in package 'com.limaoyuan.button'
这是什么原因?在线等待
<declare-styleable name="MyButton">
<attr name="who" format="string" />
</declare-styleable>多加了一个who属性然后在main.xml中,
加命名空间了xmlns:t=" http://schemas.android.com/apk/res/com.limaoyuan.button"然后在定义Button的地方
<com.limaoyuan.button.MyButton
t:who="aaad"/>
报No resource identifier found for attribute 'who' in package 'com.limaoyuan.button'
这是什么原因?在线等待
当初我也遇到过这个问题,最后放弃用自定义了!
R.styleable.xxx);
原因2:包名写错,多写或漏写
解决方式:
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" >