我想知道爲什麼日食顯示警告「[I18N]硬編碼字符串」TextView「,應該使用@string資源」在下面的xml代碼。其實我試圖將活動中的編輯文本中用戶寫入的文本發送到當前活動。程序工作正常,但日食顯示警告textview
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="0.01"
android:text="TextView" />
</LinearLayout>
關於此警告的含義尚不清楚?將所有硬編碼字符串保存在一個地方(作爲資源)被認爲是一種很好的做法,因此Eclipse會警告您沒有。不要打擾太多,這只是一個警告。或者,您可以刪除導致該警告的行,因爲您無論如何都不使用硬編碼值。 –