开发者

Externalize strings for Android project

开发者 https://www.devze.com 2023-01-31 22:04 出处:网络
Is there any Eclipse plugin that takes strings from code and puts them in strings.xml? I found \"Externalize strings\" function开发者_开发技巧 in Eclipse, but I don\'t know how to get it to work with

Is there any Eclipse plugin that takes strings from code and puts them in strings.xml? I found "Externalize strings" function开发者_开发技巧 in Eclipse, but I don't know how to get it to work with strings.xml.


Use Refactor in Eclipse:

  • highlight the string
  • From the Eclipse menu select Refactor -> Android -> Extract Android String.

The string will be moved to strings.xml and the call to getContext().getString(R.string.my_string) generated.


You can also position your cursor over the string literal and press ctrl+1. Then choose "externalize" by the android icon.

Credits: Do externalized strings need to be in strings.xml?


use shortcut Alt+Shift+A and after that press S. it'll solve your problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号