嗨,大家好我是新來的,這是我的第一個問題硬編碼字符串「Test」,應使用@string資源
這裏是我的代碼:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ref"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Test"
/>
我不在第二次測試中不想使用字符串,我應該怎麼做?
我已經看到了這個鏈接,但我不想在我的代碼上出現任何錯誤:/有什麼辦法可以避免這個錯誤? – Edli 2012-08-03 13:14:33
這不是一個錯誤,這是一個警告。如果你不想要這個警告,你應該在strings.xml中實現你的「測試」字符串作爲 Test 並使用它像 請看我編輯過的帖子 –
2012-08-03 13:20:47
非常感謝!你真的幫我 – Edli 2012-08-03 13:51:10