I think this is a bug related to the Reform by Style option.
As you know, to prevent incorrect packaging, disable the "Reform according to style" option for the Live foreach template.
Editor> Live Templates> Android> foreach> Reformat according to style
Here is my explanation:
There are styles for the for for () statement in
Code Style> Java> Wrapper and Braces> 'for expression ()'
This makes a wrapper when using "live templates" with the "Reformat Style" option. This is not about code style rules, because it does not end when the foreach loop is already typed.
After some testing with the template text and applying Code Style, I realized that the WHEN Code Style problem is applied. The option "Convert to style" is applied before interpreting the text of the template, therefore the code style for "for ()" is applied to the text below and is wrapped.
for ($i$ : $data$) { $cursor$ }
Enter the text of the template in the editor and 'Reformat Code', it will look as follows.
for ($i$: $data$) { $cursor$ }
This is why a live template works like this.
This is just a bug, and you can use a temporary fix until the bug is fixed.
source share