Sunday, 31 May 2020

Android Themes Customisation Programatically

You can change the theme programatically by selecting a color from the screen as below. 

Main 3 things needs to be taken care

1. Action Bar

ActionBar bar = mContext.getSupportActionBar();
bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#ff0000")));

2. Status Bar 
You can make the color little darker & set it to Status Bar 
getWindow().setStatusBarColor(Color.parseColor("#000000"));


3. Navigation 
This is optional but looks if we change. 

getWindow().setNavigationBarColor(Color.parseColor("#000000"));


For remaining controls you can Google & get the accent color. 
Ex: Android Change the Button Accent Color, Android change Seekbar Accent Color etc