在使用eclipse的在布局文件时,有时编辑一些控件的字符串名字中,有时会提示诸如“Hardcoded string "下一步", should use @string resource”的警告,这是什么原因呢?
-
<Button
-
android:id="@+id/button1"
-
android:layout_width="118dp"
-
android:layout_height="wrap_content"
-
android:text="下一步"/>"
虽然上述的做法可以正常运行,但是这不是一个好习惯,应该在res/values/strings.xml中设置:
-
<?xmlversion="1.0"encoding="utf-8"?>
-
<resources>
-
<stringname="message">下一步</string>
-
</resources>
引用的时候使用:android:text="@string/message"就行了。这样做可以做到一改全改,在支持多语言时也是很有用的。如果不想编辑strings.xml文件,则用layout框中,点击控件的textview项,new一个新的string名字,再在strings.xml对应的编辑框中完善这个字符串对应的内容就行了。
=====================================================================================================
使用组合键:ctrl+shift+o可以一次性导入所有需要import的类。
=======================================================================================================
一个特定对象可能在一个java文件中多次被调用,如果要修改这个对象的名字,可以在eclipse中双击激活这个对象,会显示所有调用到的地方。然后右键选择refactor->rename即可。
分享到:
相关推荐
android studio主题-Hardcoded。
hardcoded-iolink-main
IDEa Hardcoded主题 和 Solarized Light (Alternate)主题
FindHardCodedStrings 从XCode项目的源代码中找到硬编码字符串find_strings.py:适用于iOS项目(如果源代码在Objective-C中):Python脚本,在xcode项目的源文件中搜索硬编码的字符串,并将其替换为新文件中的...
Note: This directive is hardcoded to Off for the CLI SAPI ; Default Value: Off ; Development Value: 4096 ; Production Value: 4096 ; http://php.net/output-buffering output_buffering = 4096 ; You can ...
In year 2001 nVidia released its GeForce3 3D grapics card, which was the first 3D card to use a vertex processor. The vertex processor had the advantage over the hardcoded version, since it allowed ...
查找更多错误 一个添加新检测器的插件。 探测器 CommandInjectionVulnerabilityDetector 报告:POSSIBLE_COMMAND_INJECTION 检测代码中可能的命令注入。 具体要求: Runtime . getRuntime() . exec(non_...
Feature Area: Video capture Description: This sample provides the basic video ... If you wish, you can change these hardcoded values in the code for the files to be saved to a different location.
hardcoded-iolink:Arduino的硬编码IO-Link
IAPManager 有 2 个目标,一个用于快速测试应用内购买,另一个用于在您的项目中使用。 为了测试简单,请执行以下操作: 在 STAppDelegate.m 中,将<#HARDCODED_BUNDLEI_ID#>和<#HARDCODED_VERSION#>替换为您...
so you should verify that they match (I use lsusb -v for that purpose). Dongles tested thus far are: CSR and Atheros AR3011. Firmware loading is implemented for some Atheros chips but it is not ...
有没有相国如何管理密码?都应该从什么角度考虑,抛砖引玉一下
宠物小精灵
hardcoded name "origin" to name that remote; it has been corrected to honor the "--origin <name>" option. * "git fetch" into a lazy clone forgot to fetch base objects that are necessary to ...
密切注意Hardcoded路径 使用单元测试向导在一个新的项目上添加测试是一件非常容易的事情。这个便利的特点可以节省你数百个小时的打字时间(微软的开发者为此应收取很多费用)。但是,一些事情在幕后发生了,并且...
整理代码审查工具fortify扫描的高中低危问题解决方法
Findbugs缺陷详解与英文代号的对照表
- Added Bochs compilation timestamp after Bochs version string. - GUI and display libraries (Volker) - Added new .bochsrc option to select mouse capture toggle method. In addition to the default ...
mySCADA myPRO 7硬编码凭据 CVE-2018-11311 Changelog v7.0.46 ----------------- ... - This release disables download of project using FTP protocol. The download is performed over secure SSL channel now....