adt-bundle-eclipse下的修改android项目名

Date: Mar 1st, 2013

Dongguan

QX.Zhong

===============================


1. 原android项目名为AndroidIntro,程序运行界面如下图:


顶栏的程序名称如项目名一致。


2. 通过eclipse IDE修改项目,右击项目->Rename->FirstAPP,编译程序后,运行结果如下:

 顶栏的程序名依然纹风不动。


3. 问题解决,eclipse中,打开项目根目录中的AndoirManifest.xml文件,找到如下内容

 1 <application
 2         android:allowBackup="true"
 3         android:icon="@drawable/ic_launcher"
 4         android:label="@string/app_name"
 5         android:theme="@style/AppTheme"
 6         android:debuggable="true">
 7         <activity          
 8             android:name="com.demo.firstapp.MainActivity"
 9             android:label="@string/app_name" >
10             <intent-filter>
11                 <action android:name="android.intent.action.MAIN" />
12 
13                 <category android:name="android.intent.category.LAUNCHER" />
14             </intent-filter>
15         </activity>
16     </application>

按住Ctrl键单击第四行内容:android:label="@string/app_name"

eclipse界面即自动打开项目中/res/values/strings.xml文件,内容如下

1 <?xml version="1.0" encoding="utf-8"?>
2 <resources>
3 
4     <string name="app_name">AndroidIntro</string>
5     <string name="hello_world">Hello world!</string>
6     <string name="menu_settings">More</string>
7 
8 </resources>

 

其实,修改程序名的内容是在此文件的<string name="app_name">标签中修改的,此时只需将/res/values/strings.xml中的app_name标签内容修改为目标内容,本例修改为FirstAPP,运行程序,即可达到预期目的,程序名称已经由AndroidIntro改为FirstAPP,如下图。

 


4. 收获总结

android项目的activity的layout设置,可以把所有TextView的必要硬编码值放置/res/valuse/strings.xml中定义。


posted @ 2013-03-01 11:10  qx.zhong  阅读(1134)  评论(0编辑  收藏  举报