Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: Fold all methods non-recursively

In Android Studio 3.6.1. (Java 8) there are multiple options for folding (Code -> Folding):

  • Collapse - Collapses the code block the cursor is in, if I put it at the start of a method, it only collapses that but not the if, for, whatever else inside.
  • Collapse Recursively - Collapses the code block the cursor is in but also all the if, for, //... inside.
  • Collapse All - Works like Collapse Recursively but collapses all the functions in the file, so it's actually a "Collapse All Rescursively".

Using the third option in a file with a lot of methods/code blocks, if I just want to work on a single method, means that I have to unfold everything inside that code block again.

I know that Eclipse and Visual Studio are able to fold all methods non-recursively (my shortcuts there are: Ctrl + Shift + Numpad / for folding and Ctrl + Shift + Numpad * for unfolding) but how do I do the same thing in Android Studio?

like image 507
Neph Avatar asked Oct 20 '25 15:10

Neph


1 Answers

Unfortunately it appears this can't be done. The best way to deal with this that I've found is to expand the desired method recursively with ctrl alt +

like image 148
Termenoil Avatar answered Oct 22 '25 06:10

Termenoil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!