From what I read elsewhere, the compiler error "No resource identifier found" for custom attributes goes away when you change the namespace for an included project to: xmlns:si="http://schemas.android.com/apk/lib/com.my.base.project" instead of "xmlns:si="http://schemas.android.com/apk/res/com.my.base.project"
This still doesn't solve the problem of actually reading the custom attribute's value. From a non project context. The control just gets the default value. Any ideas to get this working?
In my application I use this custom attribute like so in a layout XML file:
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:si="http://schemas.android.com/apk/lib/com.my.base.project">
<com.my.base.project.view.CustomView
si:collapsedHeight="100dp">
</com.my.base.project.view.CustomView>
</merge>
From the release notes:
Added support for custom views with custom attributes in libraries. Layouts using custom attributes must use the namespace URI http://schemas.android.com/apk/res-auto instead of the URI that includes the app package name. This URI is replaced with the app specific one at build time.
They marked it as "released" with SDK Tools, Revision 17 (March 2012).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With