Mike Reece Mike Reece - 1 month ago 5
Android Question

How do you toggle between Dimens/Strings id vs their actual value?

This question is kind of difficult to put in words, but I want to know how to toggle between the dimens/strings id's vs their actual values. The IDE is IntelliJ. An image should make it a bit more clear what I'm asking:

Upper image is actual values, lower image is with full id

Upper image is actual values, lower image is with full id displayed. If you click on the

60dp
, it will then display the full id. I'm interested in how to then revert it back to the original
60dp
. I've spent some time trying to find it online and but couldn't find anything. I know that I could always just do a "go to declaration" on the id and find the actual value in strings.xml, but it would be significantly faster to just read it on the spot. Any other useful IntelliJ/Android tips someone could think of would be welcome too. If you could help me I'd be very happy.

Answer

On Windows press Ctrl+> to both expand and collapse when the cursor is within the value/code you want to perform Folding on or just use Ctrl++ or Ctrl+-.

This is called code folding and can also be found under the contextual menu (when you right click on the code) then Folding (See image below)

enter image description here

Comments