Reputation: 241
I need to insert "<<" in android:text = "<<"
but there are raise problem with:
Multiple annotations found at this line:
- [I18N] Hardcoded string "<<", should use @string resource
- The value of attribute "android:text" associated with an element type "Button" must not contain the '<'
character.
Can you tell me how can I insert <<
in xml file TextView
text?
Upvotes: 12
Views: 4773
Reputation: 755
You need to use the escaped version of <, which is <. Similarly, > should be replaced with > if required.
Upvotes: 0
Reputation: 2310
Use a string assignment, as the suggestions says. Create a string in strings.xml
, like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
..
<string name="chevrons"><<</string>
</resources>
Then point the TextView
to that, like this:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="20sp"
android:text="@string/chevrons"
>
</TextView>
Upvotes: 2
Reputation: 3292
You need to use the less-than XML escape character. See a full list here:
<<
Upvotes: 4
Reputation: 39651
Try <<
instead of <<
. You have to escape those characters because they influence your XML layout.
Upvotes: 21