本文整理了Java中android.support.v7.widget.CardView.setBackgroundColor()
方法的一些代码示例,展示了CardView.setBackgroundColor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CardView.setBackgroundColor()
方法的具体详情如下:
包路径:android.support.v7.widget.CardView
类名称:CardView
方法名:setBackgroundColor
暂无
代码示例来源:origin: wenwenwen888/DouBan_Movie
@Override
public void onBindViewHolder(final MyViewHolder holder, int position) {
Context context = holder.itemView.getContext();
if (MyApplication.NIGHT_MODE) {
holder.cardView.setBackgroundColor(context.getResources().getColor(R.color.colorNight));
}
//设置头像
Glide.with(context).load(imgs.get(position)).into(holder.ivMovieDetailItem);
//设置名字
holder.tvMovieDetailItem.setText(names.get(position));
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mOnItemClickListener.onItemClick(ids.get(holder.getAdapterPosition()), names.get(holder.getAdapterPosition()));
}
});
}
代码示例来源:origin: wenwenwen888/DouBan_Movie
private void checkIsNightMode() {
if (MyApplication.NIGHT_MODE) {
srlCelebrityDetail.setColorSchemeColors(getResources().getColor(R.color.colorNight));
cardView.setBackgroundColor(getResources().getColor(R.color.colorNight));
tvCelebrityName.setTextColor(getResources().getColor(R.color.colorWhite));
tvCelebrityPlace.setTextColor(getResources().getColor(R.color.colorWhite));
tvCelebrityRoles.setTextColor(getResources().getColor(R.color.colorWhite));
}
}
代码示例来源:origin: konradrenner/kolabnotes-android
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
boolean isSelected = SelectableAdapter.getSelectedItems().contains(position) ? true : false;
final Tag tag = tags.get(position);
holder.tagName.setText(tag.getName());
holder.tagCreatedDate.setText(context.getResources().getString(R.string.tag_creationDate) + ": " +
dateFormatter.format(tag.getAuditInformation().getCreationDate()));
holder.tagModificationDate.setText(context.getResources().getString(R.string.tag_modificationDate) + ": " +
dateFormatter.format(tag.getAuditInformation().getLastModificationDate()));
Drawable circle = ContextCompat.getDrawable(context, R.drawable.tag_list_default_circle);
if (tag.getColor() != null) {
circle.setColorFilter(Color.parseColor(tag.getColor().getHexcode()), PorterDuff.Mode.MULTIPLY);
}
holder.tagColor.setBackground(circle);
Utils.setElevation(holder.tagColor, 3);
if (isSelected) {
holder.tagColor.setClickable(false);
holder.tagName.setBackgroundColor(COLOR_SELECTED_NOTE);
holder.tagCreatedDate.setBackgroundColor(COLOR_SELECTED_NOTE);
holder.tagModificationDate.setBackgroundColor(COLOR_SELECTED_NOTE);
holder.tagHolder.setBackgroundColor(COLOR_SELECTED_NOTE);
} else {
holder.tagColor.setClickable(true);
holder.tagName.setBackgroundColor(Color.TRANSPARENT);
holder.tagCreatedDate.setBackgroundColor(Color.TRANSPARENT);
holder.tagModificationDate.setBackgroundColor(Color.TRANSPARENT);
holder.tagHolder.setBackground(ContextCompat.getDrawable(context, R.drawable.item_round));
}
}
内容来源于网络,如有侵权,请联系作者删除!