Android Studio doesn't put all methods in one line when using code folding, and it's rather annoying, because I cannot tell the difference. I don't know why one method can be put in one line, and why another method cannot.
As you can see on this picture below if you look at the method where the cursor is that the upper folding sign is in the line of the name of the function. When I fold it, the method will be in one line. However there are several methods where the upper folding sign in below the line of the name of the function. When I fold it, the method will be in two lines. The first line will include the name of the method, and the second will be "{...}".
How can I fix this? Can this be fixed at all?
Please note the I wouldn't like to put the curly brackets in the line of the name of the function.
Move to :
Settings >> Editor >> General >> Code Folding
You will find Method Bodies and One-line methods check there if you want to make methods in ONE-LINE.
Now Restart android-studio OR for class just close and reopen the same.
To disable outline in code
Go to File -> Settings -> Editor -> General -> Code Folding
Uncheck Show code folding outline
Now shortcuts are,
For Windows:
Minimize: CTRL + SHFT + '-'
Expand: CTRL + SHFT + '+'
I noticed the differnce between the lines folded and the lines not folded.
It's the length of the lines.
The lines that are longer than the width of the page (gray line) are not and cannot be folded. But the lines that are shorter that the width when folded are and can be folded.
The width of the page can be adjusted in:
Preferences / Editor / Code Style / Right margin(columns)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With