简体   繁体   English

创建不带Photoshop知识的简单启动画面(Ionic / Cordova)

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

I want to create a splashscreen image/psd. 我想创建一个启动画面图像/ psd。 This has to be 2048x2048 resolution. 这必须是2048x2048分辨率。 It will be a just an image on the center of the page with a background color. 这将只是页面中心背景的图像。 How to do this without getting lost in photoshop. 如何做到这一点而又不会在Photoshop中迷路。 Any ideas will greatly help. 任何想法都会有很大帮助。

Thanks 谢谢

Take a look at: https://www.bignerdranch.com/blog/splash-screens-the-right-way/ 看看: https//www.bignerdranch.com/blog/splash-screens-the-right-way/

In effect you create a Drawable XML, something like: 实际上,您创建了一个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>

Then in your Style Values: 然后在您的样式值中:

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

Create a new Activity (Blank) and make it your Start activity (in Android Manifest): 创建一个新的活动(空白)并将其设为您的“开始”活动(在Android Manifest中):

<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' should just forward you to your MainActivity; “ SplashActivity”应该将您转发到您的MainActivity; something like: 就像是:

public class SplashActivity extends AppCompatActivity {

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

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

Note that you do not inflate a view at all! 请注意,您根本不会使视图膨胀! You use the Window background from your style to do the work. 您可以使用style的Window背景来完成工作。

If you want to go for more flexible option yet without getting your hands dirty on complex implementation then this lib will greatly help you out. 如果您想寻求更灵活的选择而又不致于手忙于复杂的实现,那么此lib将极大地帮助您。

https://github.com/ViksaaSkool/AwesomeSplash https://github.com/ViksaaSkool/AwesomeSplash

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM