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

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

问题描述

我在Mac OS X上运行Android Studio,无法在编辑器中看到硬编码的字符串值,也无法看到drawables预览.无论如何,我可以在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!

推荐答案

必须在设置">编辑器">代码折叠"下选中"Android字符串引用"选项,但默认情况下选中该选项.对我来说,它似乎并没有自动进行字符串预览.我必须右键单击某些代码(例如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天全站免登陆