Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio does not show strings preview

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!

like image 358
user2340612 Avatar asked May 16 '13 16:05

user2340612


3 Answers

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.

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.

like image 57
jvhashe Avatar answered Nov 15 '22 11:11

jvhashe


Press Ctrl+Period (or +Period on Mac OS X) when your cursor is on getString or the preview word, then the string is switched.

like image 23
tazoal Avatar answered Nov 15 '22 11:11

tazoal


Now you should use keyboard shortcut Command + '-' or Command + '.' in android studio to show strings preview.

like image 1
evanchin Avatar answered Nov 15 '22 12:11

evanchin