简体   繁体   中英

How to change the color that is above the Action Bar by button?

I have a button that changes only Action Bar colour. I want to change the colour that is above Action Bar by clicking the button. How can I do this?

Are you want to change statusbar color?

Window window = activity.getWindow();

window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

window.setStatusBarColor(ContextCompat.getColor(activity,R.color.my_statusbar_color));

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