硬codeD TextView的,需要字符串? [英] Hardcoded TextView and Needed String?

查看:111
本文介绍了硬codeD TextView的,需要字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为什么我需要有一个字符串,而不是硬codeD TextView的困惑。 Eclipse的告诉我,我需要使用一个字符串,但我不希望在我的的strings.xml 多串,所以我不会感到困惑。我应该怎么做才能让这些错误消息走开?

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 won't get confused. What should I do to get these error messages to go away?

推荐答案

这并不影响编译的时候,而是要摆脱警告,添加到您的查看小号

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

 tools:ignore="HardcodedText"

例如:

<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.

转到:

窗口 - >显示视图 - > Android的 - > lint警告

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

然后你会得到所有的警告名单,并可以相应地处理它们。

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

这篇关于硬codeD TextView的,需要字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆