Convert Website Into An Android App | #8 Adding a Splash Screen

 เค‡เคธ Part เคฎें เคนเคฎ เค…เคชเคจे Application เคฎें Splash Screen เคฒเค—ाเคจे เค•े เคฌाเคฐे เคฎें เคฆेเค–ेंเค—े।


1. Splash Screen เคฒเค—ाเคจे เค•े เคฒिเค เคจिเคšे เคฆिเค เค—เค Code เค•ो app > res > values > styles.xml เคฎें เคจिเคšे image เคฎें เคฆिเค–ाเค เค—เค เคธ्เคฅाเคจ เคชเคฐ Paste เค•เคฐें।

<style name="AppTheme.Launcher">
<item name="android:windowBackground">@drawable/launch_screen</item>
</style>



เค…เคฌ เค†เคชเค•े เคฎें เค‡เคธ (เคจिเคšे Image เคฎें เคฆिเค–ाเคฏा เค—เคฏा เคนै) เคคเคฐเคน เค•ा Error เค†เคเค—ा। เค‡เคธเค•ो เคนเคฎ เค…เค—เคฒे Step เคฎें Solve เค•เคฐेंเค—े।


2. เค…เคฌ เค†เคชเค•ो app > res > drawable เคฎें เคœाเคจा เคนै เคซिเคฐ Drawable เคฎें Right Click เค•เคฐเคจा เคนै เคซिเคฐ new > Drawable resource file เคฎें เคœाเคจा เคนै, เคซिเคฐ File Name เคฎें launch_screen เคจाเคฎ เคฆेเคจा เคนै เคซिเคฐ Ok เคชเคฐ Click เค•ीเคœिเคฏे।


3. เค‰เคธเค•े เคฌाเคฆ เคจिเคšे เคฆिเค เค—เค Code เค•ो  app > res > drawable>launch_screen เคฎें เคจिเคšे Image เคฎें เคฆिเค–ाเค เคนुเค เคธ्เคฅाเคจ เคชเคฐ Paste เค•เคฐें।

<?xml version="1.0" encoding="utf-8"?>

<!-- The android:opacity=”opaque” line — this is critical in preventing a flash of black as your theme transitions. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
<item android:drawable="@color/colorPrimaryDark"/>
<item>
<bitmap
android:src="@drawable/logo"
android:gravity="center"/>
</item>
</layer-list>




4. เค…เคฌ เค†เคชเค•ो เคซिเคฐ เคธे app > res > drawable เคฎें เคœाเค•เคฐ drawable เคฎें Right click เค•เคฐเค•े show in explorer เคฎें เคœाเคจा เคนै, เคซिเคฐ file explorer เคฎें drawable folder เค•े เค…ंเคฆเคฐ png format เคฎें เค…เคชเคจा Logo เค•ो small letter เคฎें logo เคจाเคฎ เคธे Paste เค•เคฐเคจा เคนै

Image เค•ा size 340x 340 เคฐเค– เคธเค•เคคे เคนैं


5. เค…เคฌ  เคจिเคšे เคฆिเค เค—เค Code เค•ो app > manifests > AndroidManifest.xml เคฎें เคจिเคšे Image เคฎें เคฆिเค–ाเค เค—เค เคธ्เคฅाเคจ เคชเคฐ Replace เค•เคฐเคจा เคนै

android:theme="@style/AppTheme.Launcher">




เค…เคฌ เค†เคช เค…เคชเคจे App เค•ो Run เค•เคฐเค•े เคฆेเค–िเคฏे เค‰เคธเคฎे Splash Screen เคฒเค— เคšूเค•ा เคนै, เค…เค—เคฐ เค†เคชเค•ो splace screen เค•े background color เค•ो change เค•เคฐเคจा เคนै เคคो เค†เคชเค•ो colors.xml เคฎें @color/colorPrimaryDark เค•े color เค•ो Change เค•เคฐเคจा เคนै

Comments

  1. I am new here. this is a very useful to add splash screen in my web view for me I done it successfully now i want to increase splash screen time so what i can add please share

    ReplyDelete
  2. I read your blog it's very nice and very helpful, I learn something new every time from this website, Thank you so much for posting!
    Cell Phone Monitoring for Parents - A hidden cell phone tracking app operates in stealth mode and is completely invisible to the users of the target Android device.

    ReplyDelete

Post a Comment

Popular posts from this blog

Convert Website Into An Android App | #10 Set Up Push Notifications

Convert Website Into An Android App | #6 Add Swipe down to Refresh functionality