Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switch between reference and value preview of string resources in the xml editor

when working in Android Studio in xml values and referencing to @Strings/xy for instance, I have seen in a video, that it is actually possible to display the actual values directly in the same editor window. It was basically a switch to between @String/xy and "XYContent", but with the reference still existing.

I am not referencing to "ctrl+click" which opens (in my case) the strings.xml in a new tab.

Any idea? Couldn't find any reference to this in the help file.

like image 331
flo west Avatar asked Jan 02 '16 11:01

flo west


2 Answers

You can go to Preferences => Appearance & Behavior => Editor => General => Code Folding and enable Android String References to always see the value of string resource in the java file.

like image 200
Artem Avatar answered Oct 02 '22 12:10

Artem


Click and bring the cursor to the string resource reference and press Ctrl+- (Cmd for Mac, minus/hyphen) and you'll see the preview.

It basically does a collapse all for the code and collapsed string resource references show the values as preview. Collapse all action can also be done from the menu if you are comfortable with mouse more than keyboard. Right-Click -> Folding > Collapse

To switch back press Ctrl++ (Cmd for Mac) with the cursor still on same reference.

like image 27
AndroidMechanic - Viral Patel Avatar answered Oct 02 '22 12:10

AndroidMechanic - Viral Patel