從零開始學android開發-adt-bundle-eclipse下的修改android app名稱


eclipse中,打開項目根目錄中的AndoirManifest.xml文件,找到如下內容

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:debuggable="true">
        <activity          
            android:name="com.demo.firstapp.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

按住Ctrl鍵單擊第四行內容:android:label="@string/app_name"

eclipse界面即自動打開項目中/res/values/strings.xml文件,內容如下

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">AndroidIntro</string>
    <string name="hello_world">Hello world!</string>
    <string name="menu_settings">More</string>

</resources>

其實,修改程序名的內容是在此文件的<string name="app_name">標簽中修改的,此時只需將/res/values/strings.xml中的app_name標簽內容修改為目標內容,本例修改為FirstAPP,運行程序,即可達到預期目的,程序名稱已經由AndroidIntro改為FirstAPP,如下圖。

android項目的activity的layout設置,可以把所有TextView的必要硬編碼值放置/res/valuse/strings.xml中定義。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM