【发布时间】:2017-07-24 12:50:16
【问题描述】:
我制作 RN 应用程序。对于我制作的Android版本 /drawable/splash_screen.xml 包含以下内容
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/gray"/>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher"/>
</item>
</layer-list>
并在 res/values/styles.xml 中链接到该文件
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash_screen</item>
</style>
也在 AndoirdManifest.xml 中
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/SplashTheme"
android:screenOrientation="landscape"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
这很好用,但我想制作 SVG 文件而不是 PNG(mipmap/ic_launcher)。 SVG 文件可能是这样的 https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html (至少没有动画)。 如何做到这一点?
【问题讨论】:
-
我尝试了一个比例drawable,但它的默认级别是0,不能在drawable xml中设置。这是一种耻辱,因为这将是解决方案。
标签: android svg react-native