简体   繁体   中英

android studio - I want to change background color of circular button

在此处输入图片说明 I'm making a circular button that changes its color and keep it.

I'm trying to use

button.etBackgroundColor(getColor(R.color.color));

But in this case, new color makes not circle but square.

I have read

Change background color of circular button android

But i couldn't understand and there is no specific explanation.

what should i do?

You can change your button background color by setting background tint color, like bellow

button.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#00FFAA"))); // Just replace code with your color code 

It will work for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM