0
나는 정말로 뒤죽박죽이다. 내보기에 대한 사용자 지정 xml 태그를 만드는 방법을 배우기에 this 링크를 따라갔습니다. 글쎄, 나는 내가 모든 것을 올바르게했다고 말할 수있다. 그러나 일식은 여전히 토스카를 던진다 error: No resource identifier found for attribute 'radius' in package 'com.theliraeffect.fantasy'
사용자 정의 XML 태그가 해결되지 않습니까?
사람은 볼 수 있냐?
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>
그냥 경우 (나는 그것과 아무 상관이 의심 있지만).
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();
}
}
사이드 노트 : 시작한 활동 (내가 만지지 않은 것) 이외에 전체 프로젝트입니다. 나는 이것으로 일하는 완전히 새로운 프로젝트를 시작했다. – AedonEtLIRA
당신이 제공 한 링크에서'비표준 안드로이드 속성이 선언 된 타입을 가져야합니다'라고 생각합니다. attrs.xml에서'radius ='에'format = ".."'을 추가해야한다는 것을 의미합니다. – harism