在没有 photoshop 知识的情况下创建简单的启动画面(Ionic/Cordova)

Creating Simple Splash screen without photoshop knowledge( Ionic/Cordova )

我想创建启动画面image/psd。这必须是 2048x2048 分辨率。 它将只是页面中心的一张带有背景颜色的图像。 如何在不迷失在 Photoshop 中的情况下做到这一点。任何想法都会有很大帮助。

谢谢

看看:https://www.bignerdranch.com/blog/splash-screens-the-right-way/

实际上你创建了一个 Drawable XML,类似于:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/gray"/>
    <item>
        <bitmap android:gravity="center" android:src="@mipmap/ic_launcher"/>
    </item>
</layer-list>

然后在您的样式值中:

<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
    <item name="android:windowBackground">@drawable/background_splash</item>
</style>

创建一个新的 Activity(空白)并将其作为您的开始 activity(在 Android 清单中):

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

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

Teh 'SplashActivity' 应该将您转到 MainActivity;类似于:

public class SplashActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }
}

请注意,您根本没有膨胀视图!您使用 style 中的 Window 背景来完成这项工作。

如果您想获得更灵活的选择,又不想在复杂的实现上动手,那么这个库将极大地帮助您。

https://github.com/ViksaaSkool/AwesomeSplash