2017-09-26 3 views
0

박람회를 사용하여 구현 된 응용 프로그램에서 작업하고 있습니다. 난 내 애플 리케이션에 스플래시 화면이 있습니다. 스플래시 화면 로딩 화면의 아이콘은 안드로이드 장치에서는 올 바르고 IOS 장치에서는 매우 작습니다 (다른 dpi로). 아이콘을 로딩 할 때 dpi를 기준으로 크기를 조정하려고합니다. 아무도 도움이되지 않습니다. 나 여기있어. 고마워.다른 DPI 장치의 로딩 아이콘 크기 변경

구성 파일 : -

"expo": { 
    "name": "ExpoApp", 
    "description": "No description", 
    "slug": "evosus", 
    "privacy": "unlisted", // public 
    "sdkVersion": "19.0.0", 
    "version": "1.0.0", 
    "orientation": "portrait,landscape", 
    "primaryColor": "green", 
    "icon": "./assets/icons/ball.png", 
    //"icon": "./assets/icons/logo_Dark.png", 
    "notification": { 
     "icon": "./assets/icons/ball.png", 
     "color": "#000000" 
    }, 
    "loading": { 
     //"icon": "./assets/icons/loading-icon.png", 
     "icon": "./assets/icons/icon.png",//I want to resize this icon based on screen dpi 
     "hideExponentText": true 
    }, 
    "packagerOpts": { 
     "assetExts": [ 
     "ttf" 
     ] 
    }, 
    "ios": { 
     "supportsTablet": true 
    } 
    //,"androidStatusBarColor": "#444444" 
    } 
} 

App.js 구성 요소 : - 내가 제대로 기억한다면

import React from 'react'; 
import { Platform, StatusBar, StyleSheet, View } from 'react-native'; 
import { AppLoading, Asset, Font, SQLite } from 'expo'; 
import { Ionicons, EvilIcons } from '@expo/vector-icons'; 
import RootNavigation from './navigation/RootNavigation'; 

// Services 
import DB from "./src/Services/DBDefinitionService"; 
import appService from "./src/Services/AppService"; 

console.ignoredYellowBox = [ 'Setting a timer' ]; 

export default class App extends React.Component { 
    state = { 
    assetsAreLoaded: false, 
    }; 

    componentWillMount() { 
    this._loadAssetsAsync(); 
    // Added by Anil G on 23/08/2017 
    this.db_init(); 
    this.db_device_info_save(); 
    } 

    render() { 
    if (!this.state.assetsAreLoaded && !this.props.skipLoadingScreen) { 
     return <AppLoading/>; 
    } else { 
     return (
     <View style={styles.container}> 
      {Platform.OS === 'ios' && <StatusBar barStyle="default" />} 
      {Platform.OS === 'android' && 
      <View style={styles.statusBarUnderlay} />} 
      <RootNavigation /> 
     </View> 
    ); 
    } 
    } 

    async _loadAssetsAsync() { 
    try { 
     await Promise.all([ 
     Asset.loadAsync([ 
      require('./assets/images/robot-dev.png'), 
      require('./assets/images/robot-prod.png'), 
     ]), 
     Font.loadAsync([ 
      // This is the font that we are using for our tab bar 
      Ionicons.font, 
      EvilIcons.font, 
      // We include SpaceMono because we use it in HomeScreen.js. Feel free 
      // to remove this if you are not using it in your app 
      { 'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'), 
      'roboto-regular': require('./assets/fonts/Roboto-Regular.ttf'), 
      'roboto-medium': require('./assets/fonts/Roboto-Medium.ttf'), 
     }, 
     ]), 
     ]); 
    } catch (e) { 
     // In this case, you might want to report the error to your error 
     // reporting service, for example Sentry 
     console.warn(
     'There was an error caching assets (see: App.js), perhaps due to a ' + 
      'network timeout, so we skipped caching. Reload the app to try again.' 
    ); 
     console.log(e); 
    } finally { 
     this.setState({ assetsAreLoaded: true }); 
    } 
    } 

    async db_init() { 
     await DB.init(); 
    } 

    async db_device_info_save() { 
     await appService.device_info_save(); 
    } 

} 

const styles = StyleSheet.create({ 
    container: { 
    flex: 1, 
    backgroundColor: '#fff', 
    }, 
    statusBarUnderlay: { 
    height: 24, 
    backgroundColor: 'rgba(0,0,0,0.2)', 
    }, 
}); 

답변

0

당신이 @ × 2를 추가, 그것은 당신이 아이폰 OS에서와 같은 방법으로 정의 할 수 있습니다, @의 X4 ... 아이콘 이름에 각 dpi에 대해 정의합니다.