How to Change image color dynamically in android?

前端 未结 6 804
死守一世寂寞
死守一世寂寞 2020-12-13 12:58

I am doing such type of project ,In my project change Image color dynamically.

I have a one black shape color image ,when user click on this ima

6条回答
  •  死守一世寂寞
    2020-12-13 13:35

    imageView.setImageResource(R.drawable.ic_person_black_48dp);
    
    imageView.setColorFilter(imageView.getContext().getResources().getColor(R.color.desired_color), PorterDuff.Mode.SRC_ATOP);
    

提交回复
热议问题