TextView displays "false" instead of resource text
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">
</Tex开发者_开发知识库tView>
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!!!
You need to change your android:text attribute to:
android:text="@string/txtSetXYMuteLabel"
精彩评论