use of carbon.drawable.DefaultColorStateList in project Carbon by ZieIony.
the class BottomBar method setMenu.
public void setMenu(Menu menu) {
this.menu = menu;
content.removeAllViews();
content.setWeightSum(menu.size());
for (int i = 0; i < menu.size(); i++) {
final MenuItem item = menu.getItem(i);
final View view = View.inflate(getContext(), R.layout.carbon_bottombar_item, null);
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (view == activeView)
return;
if (activeView != null) {
deselectItem(activeView);
}
selectItem(view);
if (listener != null)
listener.onMenuItemClick(item);
}
});
ImageView icon = (ImageView) view.findViewById(R.id.carbon_bottomIcon);
icon.setTint(new DefaultColorStateList(getContext()));
icon.setImageDrawable(item.getIcon());
TextView text = (TextView) view.findViewById(R.id.carbon_bottomText);
text.setTextColor(new DefaultColorStateList(getContext()));
text.setText(item.getTitle());
content.addView(view, new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1));
}
}
Aggregations