There are many tutorials out there and questions on SO that implement custom title bars. However, in my custom title bar I have a custom gradient for the background and I would like to know how to set it dynamically in my code.
Here is where my custom title bar gets called:
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.foo_layout); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_bar);
And this is my custom_title_bar
:
As you can see, the background on the linear layout is defined by this guy:
What I would like to do is set those gradient colors dynamically in my code. I do not want to hard code them in my XML file like they currently are.
I am open to all ideas if you have a better way of setting a background gradient.
Thank you in advance!!