Android change color of ImageView / Bitmap

后端 未结 5 1286
-上瘾入骨i
-上瘾入骨i 2021-02-15 11:19

I need to find a way to change the color of bitmap in Android. I need to replace/change colors of oval image smoothly in my application depending on int value. I ne

5条回答
  •  长发绾君心
    2021-02-15 11:59

    getResources().getDrawable( R.drawable.button );
    

    is now deprecated. Can also do it this way:

    ((ImageView) findViewById(R.id.my_icon))
      .setColorFilter(new LightingColorFilter(Color.BLUE, Color.BLUE));
    

提交回复
热议问题