#pragma mark equivalent in Android Studio
Solution 1:
In Android Studio you can add regions using the steps below
- Open the IDE you are using
- Select the code you want to group
- Press Ctrl + Alt + T (Cmd + Opt + T for mac) and select the “region .. end region comments”
- Now the code is surrounded with “//region” / “//endregion” lines, you can see that the region can be fold-able
- You can now edit the description of your group
- You can easily see the code within your group without having to expand the group, just hover the group description with the mouse pointer
See this
Solution 2:
Meet custom folding regions, the IntelliJ IDEA (where Android Studio is derived from) way to customized code structure support (that is what jump bar serves in Xcode).
Keyboard shortcut ⌥⌘T or manual typing,
// region REGION_NAME
// YOUR CODE HERE
// endregion
Here is the missing gif demo (that people want in their official doc) showing how Android Studio behaves when two customized regions are added.
Official Documentation
https://www.jetbrains.com/help/idea/code-folding-settings.html
Solution 3:
No idea why answers by Android Developers mostly lacking clarity. Here is my contribution.
Simply said, just wrap the codes with
//region SECTION NAME
...
//endregion