Android: Add custom view attribute

Posted: October 23, 2014 in Android
Tags:

The steps are well documented in the android developer site. http://developer.android.com/training/custom-views/create-view.html

But when you followed all the steps, you may receive this error: No resource identifier found for attribute ‘xxxxx’ in package ‘com.xxxxx’

It caused me hours to figure out the reason: when you declare the namespace, it should be xmlns:custom=”http://schemas.android.com/apk/lib/com.example.yourview”, instead of xmlns:custom=”http://schemas.android.com/apk/res/com.example.yourview”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s