0

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"
  android: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();
    }
}
Community
  • 1
  • 1
ahodder
  • 11,060
  • 14
  • 63
  • 109
  • As a side note: Other than the starting activity (which I haven't touched) this is the entire project. I started an entirely new project just to work with this. – ahodder May 14 '11 at 14:47
  • 1
    From the link you provided `Non-standard android attributes need to have their type declared` , which , I'm guessing means you have to add `format=".."` for `radius` in attrs.xml. – harism May 14 '11 at 16:11

1 Answers1

0

@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.

ahodder
  • 11,060
  • 14
  • 63
  • 109