Android studio 不显示字符串预览 [英] Android studio does not show strings preview

查看:61
本文介绍了Android studio 不显示字符串预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Mac OS X 上运行 Android Studio,但无法在编辑器中看到硬编码的字符串值,也无法看到可绘制预览.无论如何,我可以在 xml 文件中看到颜色预览.有什么我需要开启的选项吗?

I'm running Android Studio on Mac OS X and I'm not able to see the hard-coded strings values in the editor as well as I cannot see drawables preview. Anyway, I can see colour preview in the xml file. Is there any option that I need to turn on?

我知道这可能是由于一个错误,但他们强烈宣传了这个功能,所以恕我直言它有效!

I know that this may be due to a bug, but they've strongly publicized this feature so IMHO it works!

推荐答案

必须在 Settings > Editor > Code Folding 下选中Android String References"选项,但默认情况下选中它.对我来说,它似乎不会自动进行字符串预览.我必须右键单击某些代码中的任意位置,例如 getString(R.string.mystring),然后转到折叠">折叠".或者,您也可以按 Ctrl + '-' 来折叠它.这可能是预期的行为或错误.似乎他们在主题演讲中暗示这是自动的,但也许不是.

The option "Android String References" must be checked under Settings > Editor > Code Folding, but it is checked by default. For me, it doesn't seem to do the string preview automatically. I have to right click anywhere in some code like getString(R.string.mystring) then go to Folding > Collapse. Or, you can just hit Ctrl + '-' to collapse it as well. This might be the intended behavior or a bug. It seems like they implied it was automatic in the keynote speech, but maybe it's not.

就可绘制预览而言,我认为它仅适用于只有一个资源实例的可绘制.因此,如果您在多个可绘制文件夹(例如 drawable-mdpi 和 drawable-hdpi)中有一个 icon.png,那么您将无法获得预览.至少,这就是它对我的工作方式.当我尝试使用仅在一个可绘制文件夹中的图标时,我才看到预览.

As far as the drawables preview goes, I think it only works for drawables with only one resource instance. So if you have an icon.png in more than one drawable folder (eg. drawable-mdpi and drawable-hdpi), then you won't get the preview. At least, that's how it worked for me. I only saw the preview when I tried it with an icon that was in just one drawable folder.

这篇关于Android studio 不显示字符串预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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