Skip to content Skip to sidebar Skip to footer

Hardcoded TextView And Needed String?

I'm confused on why I need to have a String and not a hardcoded TextView. Eclipse tells me I need to use a String but I don't want to have multiple Strings in my strings.xml so I w

Solution 1:

This does not affect compile time, but to get rid of the warnings, add this to your Views

 tools:ignore="HardcodedText"

Eg

<TextView
        android:id="@+id/large_textview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:text="Large Text"
        android:textAppearance="?android:attr/textAppearanceLarge"
        tools:ignore="HardcodedText" />

Alternatively, you can open up the Lint window which provides more options, and a way to batch handle these warnings.

Go to:

Window -> Show View -> Android -> Lint Warnings.

Then you will get a list of all the warnings and you can handle them accordingly.


Post a Comment for "Hardcoded TextView And Needed String?"