【问题标题】:How to select specific theme to use?如何选择要使用的特定主题?
【发布时间】:2018-01-14 11:20:45
【问题描述】:

我正在将我的游戏移植到 android,我希望它与 android 4.0 兼容,但 Unity 默认使用“Material”主题(从 5.0 开始提供)。有什么办法可以强制 Unity 使用 Holo 主题而不是 Material 主题?
我将目标 API 级别设置为 16 以获得最大的兼容性,并且我已经尝试过自定义清单,都替换了 Editor\Data\PlaybackEngines\AndroidPlayer\Apk 中的默认值之一并将一个放到 Assets\Plugins\Android 但我在构建过程中仍然会出错:否找到与给定名称“android:Theme.Material.Light.NoActionBar.Fullscreen”匹配的资源。但我不想使用 Material 主题,我想使用 Holo 主题。我知道我可以通过设置更高的 API 级别来解决这个问题,但我想让它与 Android 4.1 兼容。下面的文字是在两个位置都使用的清单

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    xmlns:tools="http://schemas.android.com/tools"
    android:installLocation="preferExternal"
    android:versionCode="1"
    android:versionName="1.0">
    <supports-screens
        android:smallScreens="true"
        android:normalScreens="true"
        android:largeScreens="true"
        android:xlargeScreens="true"
        android:anyDensity="true"/>

    <application
        android:theme="@android:style/Theme.Holo"
        android:icon="@drawable/app_icon"
        android:label="@string/app_name">
        <activity android:name="com.unity3d.player.UnityPlayerActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>
    </application>
</manifest>

【问题讨论】:

    标签: android unity3d build android-manifest android-theme


    【解决方案1】:

    您必须修改 Unity 中的设置,以便在将 Unity 项目导出到 apk 时,不使用 Material 主题。在我的脑海中,Unity 中有一个设置允许您为 Android 设置 maxSDK。

    【讨论】:

    • 在哪里?如果您的意思是 API 级别设置为 16,但我得到构建错误,因为 API 级别 16 是 android 4.1 并且在 android 4.1 中只有全息主题。但我安装了更多级别的 SDK。问题是当统一寻找我不想使用的材料主题时......伙计,这让我发疯......
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-04-10
    • 1970-01-01
    • 1970-01-01
    • 2021-10-16
    • 2017-09-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多