// Use inflater to infalte in the constructor.
public CategoryIconView(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.view_category, this, true);
ButterKnife.bind(this);
if(attrs != null) {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CategoryIconView);
// setIconResourceId(R.drawable.category_main);
setName(typedArray.getString(R.styleable.CategoryIconView_name));
typedArray.recycle();
}
}
Inflate layout file in customized view
最新推荐文章于 2021-05-30 07:10:58 发布