在Appcelerator Titanium中的Android应用程序名称中使用感叹号

时间:2013-05-29 19:37:33

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

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

如果我删除感叹号,它会很愉快。我甚至尝试过使用ASCII代码(!)和Unicode字符(\u0021)而没有运气。我需要做些什么特别的工作,或者这是你在Appcelerator Titanium中无法做到的事情?

旁注,一般来说,我对Appcelerator Titanium和Android开发都非常陌生,但在Web技术方面通常还算不错,因此选择了Appcelerator。我确实尝试过原生Android开发,但很快就重新评估了我多么厌恶Java。

这是我的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>

1 个答案:

答案 0 :(得分:2)

我认为正确的做法是通过国际化:

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>