In android I have a primary light color and status bar, can I make these a gradient between #F3A183 and #EC6F66? If so how can I achieve this?
In android I have a primary light color and status bar, can I make these a gradient between #F3A183 and #EC6F66? If so how can I achieve this?
Programmatically you can set Background of toolbar like this
toolbar.setBackgroundResource(R.drawable.gradient_one);
Your gradient may look like this
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<corners android:radius="9dp"/>
<gradient
android:startColor="#cc4151"
android:centerColor="#d95a5e"
android:endColor="#e27e70">
</gradient>
</shape>
You can also set the gradient color programmatically through the ActionBar
ActionBar actionBar = getSupportActionBar();
actionBar.setBackgroundDrawable(AppCompatResources.getDrawable(context, R.drawable.toolbar_background));
toolbar_background drawable with the gradient colors as follows:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle:="45"
android:startColor="#F3A183"
android:endColor="#EC6F66">
</gradient>
<size android:width="24dp"/>
<size android:height="24dp"/>
</shape>