java.lang.NoSuchMethodException: [class android.content.Context, interface androidutil.Attri

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





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章