I am facing a one issue with my splash screen. Actually everything works fine but i dont know where i am making a issue and that's a point of my mistake.
[](
<item android:drawable="@color/blue"/>
<item
android:drawable="@drawable/splash"
android:width="300dp"
android:height="300dp"
android:gravity="center"
/>
)
2 Layout folder having launch_screen.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="@drawable/splash"
android:gravity="center">
<!--<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/splash"
android:scaleType="centerCrop"
/>//-->
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="blue">#4F6D7A</color>
<color name="primary_dark">#4F6D7A</color>
</resources>
4 Values folder having styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
<item name="android:windowFullscreen">true</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/background_splash</item>
<item name="android:windowFullscreen">true</item>
</style>
</resources>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kikleeapp">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">
<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>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:exported="true"
>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
package com.kikleeapp;
import com.facebook.react.ReactActivity;
import android.os.Bundle; // here
import org.devio.rn.splashscreen.SplashScreen; // here
public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this, true);
super.onCreate(savedInstanceState);
}
protected String getMainComponentName() {
return "kikleeapp";
}
}
package com.kikleeapp;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.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();
}
}
This is the complete code which works very well. But what is happening in this it goes first to the background_splash.xml and then goes to launch_screen.xml.
My background splash works very well when it reach to launch_screen.xml. But initially it calls the background_splash.xml where the background image is very small.
@wontone18 Hi~~
Maybe try this:
styles
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<!-- <item name="android:windowIsTranslucent">true</item> -->
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:textColor">#000000</item>
</style>
</resources>
colors
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary_dark">#000000</color>
</resources>
:) i tried it that way also but not working. But it is fix with another plugin react-native-bootsplash. And it is working very smoothly.
Most helpful comment
:) i tried it that way also but not working. But it is fix with another plugin react-native-bootsplash. And it is working very smoothly.