public void addItem(@DrawableRes int ico) {
EmojiTabItemView itemView = new EmojiTabItemView(getContext());
itemView.setImageResource(ico);
if (mItemBackgroundRes == 0) {
StateListDrawable stateListDrawable = new StateListDrawable();
stateListDrawable.addState(new int[]{android.R.attr.state_checked},
new ColorDrawable(getResources().getColor(R.color.default_base_bg_press)));
stateListDrawable.addState(new int[]{android.R.attr.state_pressed},
new ColorDrawable(getResources().getColor(R.color.default_base_bg_press)));
stateListDrawable.addState(new int[]{}, new ColorDrawable(Color.TRANSPARENT));
itemView.setBackground(stateListDrawable);
} else {
itemView.setBackgroundResource(mItemBackgroundRes);
}
addView(itemView, -1, -1);
itemView.setOnClickListener(this);
}
EmojiTabLayout.java 文件源码
java
阅读 35
收藏 0
点赞 0
评论 0
项目:RLibrary
作者:
评论列表
文章目录