Android:删除白色启动屏幕

时间:2018-04-02 00:22:26

标签: android performance splash-screen

我已经尝试实现启动画面以删除那个白色的启动屏幕,但我仍然在那里找到它。如何使用不同颜色更改白色启动屏幕或让我的启动画面显示白色启动屏幕?

的AndroidManifest.xml

  <activity
    android:name=".SplashActivity"
    android:theme="@style/SplashTheme"
    android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>

值/ styles.xml

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:statusBarColor">@color/blue</item>
    <item name="android:windowDisablePreview">true</item>
        <!-- Customize your theme here. -->
    </style>
    <style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowBackground">@drawable/background_splash</item>
    <item name="android:statusBarColor">@color/blue</item>
    <item name="android:windowDisablePreview">true</item>

    </style>
</resources>

值/颜色/ .XML

   <?xml version="1.0" encoding="utf-8"?>
    <resources>
         <color name="status_bar_color">#233240</color>
          <color name="blue">#233240</color>
          <color name="primary_dark">#233240</color>

    </resources>

布局/ SplashScreen.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/blue"
>
</LinearLayout>

MainActivity.java

public class MainActivity extends ReactActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        SplashScreen.show(this, true);
        super.onCreate(savedInstanceState);

    }

SplashActivity.java

public class SplashActivity extends  AppCompatActivity{


    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }

}

0 个答案:

没有答案