次の設定がある場合:
public class ABCView extends View {
//implementation here
}
次のカスタム属性を使用:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name = "ABCView" >
<attr name="foo" format="boolean"/>
</declare-styleable>
</resources>
このビューを別のビューでサブクラス化したいが、カスタム属性の値を XML で指定できるようにするにはどうすればよいですか?
public class DEFView extends ABCView {
//implementation here
}
しかし、XML で子ビューを使用しようとすると、エラーが発生します。Java クラス間の関係を認識していないように見えるため、属性が適用されることを認識しません。どうすればこれを処理できますか?