react-native APP icon and Splash (Android)

First look at the common phone resolution

//   mdpi    480*320
//   hdpi    800*480
//   xhdpi   1280*720
//   xhdpi   1920*1080

APP modified name

Find android / app / src / main / AndroidManifest.xml

<application
            android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:allowBackup="false" android:theme="@style/AppTheme"> </application> 

Found android: label = "@ string / app_name". This correspondence is the name of APP

Enter: android / app / src / main / res / valuse / strings.xml directory

<resources>
    <string name="app_name">APP名称</string> </resources> 

APP modified icon

1, find a place to read APP icon

Enter the directory :: android / app / src / main / AndroidManifest.xml

<application
            android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:allowBackup="false" android:theme="@style/AppTheme"> </application> 

You can see, icon mipmap is ic_launcher picture in the file, therefore, the new mipmap_hdpi in android / app / src / main / res, mipmap_mdpi, mipmap_xhdpi, mipmap_xxhdpi files, which were stored pictures ic_launcher,
resolutions are 72x72, 48x48 , 96x96, 144x144,192 * 192

Modify Splash

Attach Address: https://github.com/crazycodeboy/react-native-splash-screen

installation
npm install react-native-splash-screen --save react-native link react-native-splash-screen 
Check the link

settings.gradle

include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android') 

build.gradle

compile project(':react-native-splash-screen')

MainApplication.java

import org.devio.rn.splashscreen.SplashScreenReactPackage;

new SplashScreenReactPackage()
Start page settings

New layout file in the android / app / src / main / res, 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/launch_screen"> </LinearLayout> 

MainActivity.java

import android.os.Bundle; import org.devio.rn.splashscreen.SplashScreen; protected void onCreate(Bundle savedInstanceState) { SplashScreen.show(this); // <--添加这一句 super.onCreate(savedInstanceState); } 

New drawable_hdpi, drawable_mdpi, drawable_xhdpi, drawable_xxhdpi files, which are stored in the picture launch_screen android / app / src / main / res,
resolution, respectively, for the beginning of the article mentioned in the resolution,
increase your first page

import SplashScreen from 'react-native-splash-screen';

componentDidMount() { SplashScreen.hide(); //关闭启动屏幕 } 

At this point, the entire start page completed

 
 
1 person thumbs up
 
React-Native

 

 

Guess you like

Origin www.cnblogs.com/chenzxl/p/11426194.html