android splash screen
AndroidManifest.xml
<application android:theme="@style/Theme.Test.Launcher" </application>
themes.xml
<resources xmlns:tools="http://schemas.android.com/tools"> <style name="Theme.Test.Launcher"> <item name="android:windowBackground">@drawable/launch_screen</item> </style> </resources>
launch_screen.xml для векторного изображения
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque"> <item android:drawable="@color/orange"/> <item android:drawable="@drawable/logo_splash" android:gravity="center"/> </layer-list>
launch_screen.xml для png
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque"> <item android:drawable="@color/red"/> <item> <bitmap android:src="@drawable/logo_splash" android:gravity="center"/> </item> </layer-list>
MainActivity.java
public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_Test); super.onCreate(savedInstanceState); } }