我应该如何创造AndroidStudio / intellijidea字符串? [英] How should I be creating strings in AndroidStudio / intellijidea?

查看:226
本文介绍了我应该如何创造AndroidStudio / intellijidea字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写我的布局和每一次我在@字符串类型时间/新的,它只是警告我说字符串引用不存在的,但不显示任何帮助来创建它。我得去我的strings.xml并为新的字符串类型的XML标记。

I'm writing my layouts and every time i type in a @string/new it just warns me that the string reference does not exist, but doesn't show any helper to create it. I have to go to my strings.xml and type in the xml tag for the new string.

的演示表明,Android的工作室甚至代替了code得到与实际弦弦,但从未演示显示了从零创建一个字符串。

The demos show that Android Studio even replaces the code to get strings with the actual strings, but the demo never shows a string being created from zero.

我知道,当我在可视化编辑器是我可以在屏幕上创建一个新的字符串元素我得到的,如果我点击...按钮文本属性,但我怎么从一开始这个功能布局的文本视图?

I know that when I'm in the visual editor I can create a new string element on the screen I get if I click the "..." button for the text property, but how do I get this functionality from the textual view of a layout?

推荐答案

我没有使用过的新的Andr​​oid工作室的扩展,因为它不会出现是用于生产环境不够稳重又不失,但在普通的老式的IntelliJ IDEA 12 ,如果你使用<大骨节病>替代 - <大骨节病>输入上冲 R.string.foo 参考,的有意的菜单中有创建字符串资源作为一个项目。选择这种意图将弹出对话框中添加的字符串。从该对话框,您可以在字符串类型,然后选择要使用的资源的过滤器(即它的strings.xml将它添加到)。

I haven't used the new Android Studio extension, as it doesn't appear to be stable enough for production use yet, but in plain old IntelliJ IDEA 12, if you use Alt-Enter on the red R.string.foo reference, the intention menu has "Create string resource" as an item. Selecting that intention brings up the dialog to add the string. From the dialog you can type in the string and select which resource filters to use (i.e. which strings.xml to add it to).

这篇关于我应该如何创造AndroidStudio / intellijidea字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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