8

Under Android Studio 1.0.2 is there a way to fold the block of code for a Switch conditional statement? I could not find how to do it online or in File > Settings.

2 Answers 2

10

Select the code block and right click to choose fold code block (it "says" Ctrl-Shift-Period but Ctrl-Shift-Period doesnt really do it....)

3
  • That does not fold the Switch block, it acts on the whole code. The Switch block does not have the - or + mini_icons to the left of its lines.
    – samjesse
    Feb 16, 2015 at 2:12
  • Whoops. Typo on my part Its Ctrl-Shift-Period is supposed to do it Feb 17, 2015 at 22:44
  • 2
    on mac it's cmd-shift-period Aug 23, 2016 at 13:07
5

To fold an arbitrary selected block

  1. Select contiguous fragment of code in the editor.
  2. On the main menu, choose Code|Folding|Fold Selection/Remove Region, or press Ctrl+Period

Source: https://www.jetbrains.com/help/idea/2017.1/code-folding.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.