菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
48
0

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

原创
05/13 14:22
阅读数 96185
<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>






发表评论

0/200
48 点赞
0 评论
收藏