标签:自定义控件android relativitylayout 常见错误
<pre name="code" class="java"><span style="font-size:24px;">private int mIndex; public HomeItem(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub mContext = context; TypedArray attrs_index = context.obtainStyledAttributes(attrs, R.styleable.attrs_index);//实现该属性 mIndex = attrs_index.getInteger(R.styleable.attrs_index_index, 0); //此处执行初始化操作 }</span>
</pre><pre name="code" class="java"><pre name="code" class="java"><span style="font-size:24px;">attrs.xml <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="attrs_index"> <attr name="index" format="integer" /> </declare-styleable> </resources></span>
java.lang.NoSuchMethodException: <init> [class android.content.Context, interface androidutil.Attri
标签:自定义控件android relativitylayout 常见错误
原文地址:http://blog.csdn.net/woyaochenggong774/article/details/47005643