How to change shape colors in Drawable?

后端 未结 3 1957
猫巷女王i
猫巷女王i 2021-02-09 17:29

I have the following button:

3条回答
  •  死守一世寂寞
    2021-02-09 18:26

    It is possible by having different images in drawable. Consider, if you want to change the green color into black, you need to have black color circle in drawable and then try this code. This will help you..

    On the button click event, use this code

    public void onClick(View v) {
       if(v == ButtonName) {
         ButtonName.setImageResource(R.drawable.ImageName);
       }
    }
    

提交回复
热议问题