【问题标题】:Using an exclamation mark in an Android app name in Appcelerator Titanium在 Appcelerator Titanium 的 Android 应用名称中使用感叹号
【发布时间】:2013-05-25 05:13:51
【问题描述】:

我正在尝试在 Appcelerator Titanium 项目(目前只是 Android)的应用名称中添加一个感叹号,但它没有。它在 tiapp.xml 文件中用红色下划线表示 The value 'App!' of element 'name' is not valid(App! 不是我的应用程序的实际名称,但你明白了)。

如果我删除感叹号,它会很高兴地工作。我什至尝试过使用 ASCII 码 (!) 和 Unicode 字符 (\u0021),但没有成功。我需要做些什么来完成这项工作,或者这是您在 Appcelerator Titanium 中无法做到的事情吗?

这是我的 tiapp.xml 文件(为简洁起见,剪掉了大片)

<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
    <property name="acs-oauth-secret-production" type="string">somenumbers</property>
    <property name="acs-oauth-key-production" type="string">somenumbers</property>
    <property name="acs-api-key-production" type="string">somenumbers</property>
    <property name="acs-oauth-secret-development" type="string">somenumbers</property>
    <property name="acs-oauth-key-development" type="string">somenumbers</property>
    <property name="acs-api-key-development" type="string">somenumbers</property>
    <id>com.myurl.app</id>
    <name>App!</name> <-- Heres my error!
    <version>1.0</version>
    <publisher>robquincey</publisher>
    <url>http://myurl.com</url>
    <description>not specified</description>
    <copyright>2013 by robquincey</copyright>
    <icon>appicon.png</icon>
    <persistent-wifi>false</persistent-wifi>
    <prerendered-icon>false</prerendered-icon>
    <statusbar-style>default</statusbar-style>
    <statusbar-hidden>false</statusbar-hidden>
    <fullscreen>false</fullscreen>
    <navbar-hidden>false</navbar-hidden>
    <analytics>true</analytics>
    <guid>theguid</guid>
    <property name="ti.ui.defaultunit" type="string">system</property>
    <iphone>
        <orientations device="iphone">
            <orientation>Ti.UI.PORTRAIT</orientation>
        </orientations>
        <orientations device="ipad">
            <orientation>Ti.UI.PORTRAIT</orientation>
            <orientation>Ti.UI.UPSIDE_PORTRAIT</orientation>
            <orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
            <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
        </orientations>
    </iphone>
    <android xmlns:android="http://schemas.android.com/apk/res/android"/>
    <mobileweb>
        <precache/>
        <splash>
            <enabled>true</enabled>
            <inline-css-images>true</inline-css-images>
        </splash>
        <theme>default</theme>
    </mobileweb>
    <modules>
        <module platform="commonjs">ti.cloud</module>
    </modules>
    <deployment-targets>
        <target device="blackberry">false</target>
        <target device="android">true</target>
        <target device="ipad">false</target>
        <target device="iphone">false</target>
        <target device="mobileweb">false</target>
        <target device="tizen">false</target>
    </deployment-targets>
    <sdk-version>3.1.0.GA</sdk-version>
</ti:app>

【问题讨论】:

    标签: android titanium appcelerator titanium-mobile appcelerator-mobile


    【解决方案1】:

    我相信正确的做法是通过国际化:

    http://docs.appcelerator.com/titanium/latest/#!/guide/Internationalization-section-29004892_Internationalization-Internationalizingtheapp%27sname

    最简单的方法是转到 platform/android/androidmanifest.xml 并在那里进行编辑。我在 2 个位置找到了它,并在两个位置都进行了更改,并且部署到模拟器工作。不要复制/粘贴下面的代码以供您查找。

    <application android:icon="@drawable/appicon"
        android:label="APPNAME!" android:name="CrmlsApplication"
        android:debuggable="false">
    
        <!-- TI_APPLICATION -->
    
        <activity android:name=".myappActivity"
            android:label="APPNAME!" android:theme="@style/Theme.Titanium"
            android:configChanges="keyboardHidden|orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    

    【讨论】:

    • 看起来不错。当我今晚回家时,我将不得不试一试,看看会发生什么。干杯。
    • 美丽。辛苦了,如果没有你,我永远不会发现,谢谢:)
    • 很高兴它为您解决了问题。你走的是国际化路线还是“快捷方式”?
    • 显然是“快捷方式” ;) 但我现在也知道如何在需要时将其全面国际化,但在我考虑到这一点之前还有很多工作要做!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-04
    • 2012-11-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多