1

Hi I have a problem with my toolbar. I'm testing on a lollipop 5.1.1. I have tried: How to add image in toolbar

This Setting header color of app in overview (recent apps) screen

takes the full width background image and squashes it into the icon.

The toolbar displays the correct background image when i am in the app (on Create or on Resume)

enter image description here but if I am in on Pause, the default colorPrimary and mipmap icon show as below

enter image description here

I have tried all suggestions on Stackoverflow. I am beginning to think that truly one cannot customise the toolbar in taskView or the recent apps screen. Does anyone know any unconventional way of having my background image in Task View (recent apps screen) and not the default colorPrimary with the default mipmap icon?

in onCreate, I tried doing the following as well:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Bitmap bm = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
            ActivityManager.TaskDescription td = new ActivityManager.TaskDescription("",bm,R.drawable.header);
            setTaskDescription(td);

whereby header is a drawable xml file that has myImage in it:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:drawable="@drawable/myImage" />
    <item>
        <shape android:shape="rectangle" android:padding="10dp">
            <corners
                 android:bottomRightRadius="5dp"
                 android:bottomLeftRadius="5dp"
                 android:topLeftRadius="5dp"
                 android:topRightRadius="5dp"/>
         </shape>
   </item>
</layer-list>

but get a crash with the warning that the primaryColor must be opaque.

Community
  • 1
  • 1

0 Answers0