问题:调用TextView.setTextColor(int colorResourceId)设置light_gray之后,字体颜色改变,设置其为black没有反应。

 

原因:Sets the text color for all the states (normal, selected, focused) to be this color.由于设置的不是colorResouceId,而是Color对应的,在不相同的情况下就不会改变其值。

 

解决办法:使用nameTextView.setTextColor(Color.parseColor(Constants.COLOR_BLACK));

 

f(viewHolder.nameFollowTextView.getTextColors()==ColorStateList.valueOf(Color.parseColor(Constants.COLOR_BLACK))){
            viewHolder.iconImageView.setImageBitmap(contact
                    .getContactPhotoBitmap());
        } else if (viewHolder.nameFollowTextView.getTextColors() == ColorStateList.valueOf(Color.parseColor(Constants.COLOR_LIGHT_GRAY))){
            Bitmap tempBitmap = BitmapUtils
                    .toGrayscale(contact.getContactPhotoBitmap());
            
            viewHolder.iconImageView.setImageBitmap(tempBitmap);
        }

 

相关文章:

  • 2021-07-21
  • 2022-12-23
  • 2023-03-18
  • 2023-04-06
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2023-03-18
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
  • 2021-11-06
相关资源
相似解决方案