very strange. I have a layout resource, which besides others defines a text view:
<TextView
android:id="@+id/txtSettingsXYMuteLbl"
android:text="@+id/txtSetXYMuteLabel"
android:textSize="20sp"
android:layout_width="wrap_content"
android:textColor="@color/colText"
android:gravity="left"
android:visibility="visible"
android:layout_height="wrap_content">
</TextView>
The text is definded in strings.xml as
<string name="txtSetXYMuteLabel">delta for no sound (sec)</string>
No manupulation of the text view takes place programmatically.
Interestingly enough the text view displays "false" wenn I run the app (device and emulator). Using any other string from strings.xml, such as
<string name="txtSeconds">Seconds</string>
leads to displaying "false" as well. Only if I change the text to a hard coded
android:text="test"
the text view correctly displays "test" as expected.
An idea would be appreciated
Instead of this
android:text="@+id/txtSetXYMuteLabel"
try this
android:text="@string/txtSetXYMuteLabel"
Hope this help!!!
您需要将android:text属性更改为:
android:text="@string/txtSetXYMuteLabel"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.