Custom XML tags won't settle?
I am truly stumped. I followed this link in learning how to create custom xml tags for my views. Well as far as I can tell I did everything correctly. But eclipse still tosses error: No resource identifier found for attribute 'radius' in package 'com.theliraeffect.fantasy'
Can you guys take a look?
hexmap.xml
<com.theliraeffect.fantasy.HexMap xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:hexmap="http://schemas.android.com/apk/res/com.theliraeffect.fantasy"
and开发者_C百科roid:layout_width="fill_parent"
android:layout_height="fill_parent"
hexmap:radius="3"/>
attrs.xml
<resources>
<declare-styleable name="HexMap">
<attr name="radius"/>
</declare-styleable>
</resources>
Just in case (although I doubt it has anything to do with it).
package com.theliraeffect.fantasy;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
public class HexMap extends View {
HexMap(Context context, AttributeSet attrs, int defstyle) {
super(context, attrs, defstyle);
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.hexmap);
a.recycle();
}
}
@Harism - Thanks, that was it. I thought that integer was a default setting and didn't need specification. It works now. If you change your comment to an answer, I will give you the credit.
精彩评论