title: How to put a vector over a gradient?
body: <p>I have the following activity xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/app_gradient_bg"
      tools:context="com.hlsystems.ericsonwillians.saltodepirapora.MainActivity"&gt;
  
      ...
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>That drawable gradient is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:app="http://schemas.android.com/apk/res-auto"&gt;
      &lt;item&gt;
          &lt;shape&gt;
              &lt;gradient
                  android:angle="90"
                  android:startColor="#007786"
                  android:endColor="#00292e"
                  android:type="linear" /&gt;
          &lt;/shape&gt;
      &lt;/item&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>This gradient is the background of all my activities. I also want to use a vector over the background, which can be achieved by adding an ImageView:</p>
  
  <pre><code>&lt;ImageView
          android:id="@+id/hlSystemsLogo"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:srcCompat="@drawable/hl_systems_logo"
          android:alpha="0.2"
          tools:layout_editor_absoluteY="61dp"/&gt;
  </code></pre>
  
  <p>Since adding the ImageView together with other UI components can get quite clumsy pretty fast, and that that gradient is the background of everything, I want to combine them, something like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:app="http://schemas.android.com/apk/res-auto"&gt;
      &lt;item&gt;
          &lt;shape&gt;
              &lt;gradient
                  android:angle="90"
                  android:startColor="#007786"
                  android:endColor="#00292e"
                  android:type="linear" /&gt;
          &lt;/shape&gt;
      &lt;/item&gt;
      &lt;item&gt;
          &lt;ImageView
              android:id="@+id/hlSystemsLogo"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              app:srcCompat="@drawable/hl_systems_logo"
              android:alpha="0.2"
              tools:layout_editor_absoluteY="61dp"/&gt;
      &lt;/item&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>But that even crashes my application.</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
                    Process: com.hlsystems.ericsonwillians.saltodepirapora, PID: 25296
                    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hlsystems.ericsonwillians.saltodepirapora/com.hlsystems.ericsonwillians.saltodepirapora.MainActivity}: android.view.InflateException: Binary XML file line #0: Error inflating class android.support.design.widget.CoordinatorLayout
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2318)
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396)
                        at android.app.ActivityThread.access$800(ActivityThread.java:139)
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
                        at android.os.Handler.dispatchMessage(Handler.java:102)
                        at android.os.Looper.loop(Looper.java:149)
                        at android.app.ActivityThread.main(ActivityThread.java:5257)
                        at java.lang.reflect.Method.invokeNative(Native Method)
                        at java.lang.reflect.Method.invoke(Method.java:515)
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
                        at dalvik.system.NativeStart.main(Native Method)
                     Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class android.support.design.widget.CoordinatorLayout
                        at android.view.LayoutInflater.createView(LayoutInflater.java:620)
                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
                        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:286)
                        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                        at com.hlsystems.ericsonwillians.saltodepirapora.MainActivity.onCreate(MainActivity.java:20)
                        at android.app.Activity.performCreate(Activity.java:5411)
                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396) 
                        at android.app.ActivityThread.access$800(ActivityThread.java:139) 
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293) 
                        at android.os.Handler.dispatchMessage(Handler.java:102) 
                        at android.os.Looper.loop(Looper.java:149) 
                        at android.app.ActivityThread.main(ActivityThread.java:5257) 
                        at java.lang.reflect.Method.invokeNative(Native Method) 
                        at java.lang.reflect.Method.invoke(Method.java:515) 
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
                        at dalvik.system.NativeStart.main(Native Method) 
                     Caused by: java.lang.reflect.InvocationTargetException
                        at java.lang.reflect.Constructor.constructNative(Native Method)
                        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
                        at android.view.LayoutInflater.createView(LayoutInflater.java:594)
                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:469) 
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
                        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:286) 
                        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                        at com.hlsystems.ericsonwillians.saltodepirapora.MainActivity.onCreate(MainActivity.java:20) 
                        at android.app.Activity.performCreate(Activity.java:5411) 
                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270) 
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396) 
                        at android.app.ActivityThread.access$800(ActivityThread.java:139) 
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293) 
                        at android.os.Handler.dispatchMessage(Handler.java:102) 
                        at android.os.Looper.loop(Looper.java:149) 
                        at android.app.ActivityThread.main(ActivityThread.java:5257) 
                        at java.lang.reflect.Method.invokeNative(Native Method) 
                        at java.lang.reflect.Method.invoke(Method.java:515) 
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
                        at dalvik.system.NativeStart.main(Native Method) 
                     Caused by: android.content.res.Resources$NotFoundException: File res/drawable/app_gradient_bg.xml from drawable resource ID #0x7f07005a
                        at android.content.res.Resources.loadDrawable(Resources.java:2156)
                        at android.content.res.Resources.loadDrawable(Resources.java:2075)
                        at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
                        at android.view.View.&lt;init&gt;(View.java:3577)
                        at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:470)
                        at android.support.design.widget.CoordinatorLayout.&lt;init&gt;(CoordinatorLayout.java:202)
                        at android.support.design.widget.CoordinatorLayout.&lt;init&gt;(CoordinatorLayout.java:198)
                        at java.lang.reflect.Constructor.constructNative(Native Method) 
                        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
                        at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:469) 
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
                        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:286) 
                        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                        at com.hlsystems.ericsonwillians.saltodepirapora.MainActivity.onCreate(MainActivity.java:20) 
                        at android.app.Activity.performCreate(Activity.java:5411) 
                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270) 
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396) 
                        at android.app.ActivityThread.access$800(ActivityThread.java:139) 
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293) 
                        at android.os.Handler.dispatchMessage(Handler.java:102) 
                        at android.os.Looper.loop(Looper.java:149) 
                        at android.app.ActivityThread.main(ActivityThread.java:5257) 
                        at java.lang.reflect.Method.invokeNative(Native Method) 
                        at java.lang.reflect.Method.invoke(Method.java:515) 
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
                        at dalvik.system.NativeStart.main(Native Method) 
                     Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #0: invalid drawable tag ImageView
                        at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
                        at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:186)
                        at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:937)
                        at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
                        at android.content.res.Resources.loadDrawable(Resources.java:2152)
                        at android.content.res.Resources.loadDrawable(Resources.java:2075) 
                        at android.content.res.TypedArray.getDrawable(TypedArray.java:602) 
                        at android.view.View.&lt;init&gt;(View.java:3577) 
                        at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:470) 
                        at android.support.design.widget.CoordinatorLayout.&lt;init&gt;(CoordinatorLayout.java:202) 
                        at android.support.design.widget.CoordinatorLayout.&lt;init&gt;(CoordinatorLayout.java:198) 
                        at java.lang.reflect.Constructor.constructNative(Native Method) 
                        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
                        at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:469) 
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
                        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:286) 
                        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                        at com.hlsystems.ericsonwillians.saltodepirapora.MainActivity.onCreate(MainActivity.java:20) 
                        at android.app.Activity.performCreate(Activity.java:5411) 
                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270) 
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396) 
                        at android.app.ActivityThread.access$800(ActivityThread.java:139) 
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293) 
                        at android.os.Handler.dispatchMessage(Handler.java:102) 
                        at android.os.Looper.loop(Looper.java:149) 
                        at android.app.ActivityThread.main(ActivityThread.java:5257) 
                        at java.lang.reflect.Method.invokeNative(Native Method) 
                        at java.lang.reflect.Method.invoke(Method.java:515) 
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
                        at dalvik.system.NativeStart.main(Native Method) 
  </code></pre>
  
  <p>How can I combine that vector and gradient in a same drawable so that I can use it in all my activities?</p>