title: @color/gray “Validates resource references inside Android XML files”
body: <p>I followed the directions on <a href="https://www.bignerdranch.com/blog/splash-screens-the-right-way/" rel="nofollow">https://www.bignerdranch.com/blog/splash-screens-the-right-way/</a> to make a splash screen for my app, but in my background_splash.xml file, the code:</p>
  
  <p><code>&lt;item android:drawable="@color/gray"/&gt;</code></p>
  
  <p>returns the message “Validates resource references inside Android XML files”.</p>
  
  <p>How do I fix this? Thanks!</p>
  
  <p>Update with code:</p>
  
  <p>background_splash.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;item
          android:drawable="@color/white"/&gt;
  
      &lt;item&gt;
          &lt;bitmap
              android:gravity="center"
              android:src="@drawable/splash"/&gt;
      &lt;/item&gt;
  
  &lt;/layer-list&gt;
  </code></pre>
  
  <p>SplashActivity.java:</p>
  
  <pre><code>package PACKAENAME;
  
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  
  public class SplashActivity extends AppCompatActivity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      Intent intent = new Intent(this, MainActivity.class);
      startActivity(intent);
      finish();
  }
  }
  </code></pre>
  
  <p>AndroidManifest.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="PACKAGENAME"&gt;
  
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
  
  
  &lt;application
  android:allowBackup="true"
  android:icon="@mipmap/ic_launcher"
  android:label="@string/app_name"
  android:supportsRtl="true"
  android:theme="@style/AppTheme"&gt;
  &lt;activity android:name=".MainActivity"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.MAIN" /&gt;
  
          &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
      &lt;/intent-filter&gt;
  &lt;/activity&gt;
  &lt;activity
      android:name=".SplashActivity"
      android:theme="@style/SplashTheme"&gt;
  &lt;/activity&gt;
  &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>