[問題] eclipse android的hello world改不掉

看板AndroidDev作者 (jjalu)時間13年前 (2012/08/03 22:20), 編輯推噓1(108)
留言9則, 2人參與, 最新討論串1/2 (看更多)
抱歉不會使用圖片, 使用的是android4.1 level 16 API, 我已經修改res/layout/activity_main.xml裡的 android:text="@string/has_been_changed", 也在res/values/strings.xml定義了has_been_changed文字變數, 基本上他都是產生好的,我只是把他的hello world改成 has been changed !!! 以下是改好的res/layout/activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/test" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/has_been_changed" android:textColor="#FF0000" android:background="#FFFFFF" tools:context=".MainActivity" /> </RelativeLayout> 但我跑模擬器Run As Android Application 執行MainActivity(?,程式卻跑出hello world, 而且我的名稱叫做app而不是MainActivity, 希望各位大大能幫忙debug。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.193.68.232

08/03 22:35, , 1F
你只是把XML => 資源代號 => 文字 你只是把資源代號改成
08/03 22:35, 1F

08/03 22:36, , 2F
has_been_changed
08/03 22:36, 2F

08/03 22:36, , 3F
MainActivity是你的Activity的名稱,不是app的名稱
08/03 22:36, 3F

08/03 22:37, , 4F
建議找本書,一步一步做
08/03 22:37, 4F

08/03 22:38, , 5F
你在改has been change那邊,應該有兩格可以改的地方,上面
08/03 22:38, 5F

08/03 22:38, , 6F
那個是資源代號,下面那個才是資源所代表的字串
08/03 22:38, 6F

08/04 00:53, , 7F
感謝La大大的解說,本來想說改改字串應該蠻簡單的
08/04 00:53, 7F

08/04 00:53, , 8F
原來這樣就已經是一步登天的想法了,手上有書我在繼續k一下
08/04 00:53, 8F

08/04 00:54, , 9F
好了,謝謝你囉
08/04 00:54, 9F
文章代碼(AID): #1G6zv0ub (AndroidDev)
文章代碼(AID): #1G6zv0ub (AndroidDev)