Reputation: 522
ctrl+shift+F work fine for what is inside the public class . but the formatting does not work inside the method, see the = sign is not aligned. why? and how do I get this to work?
public class myClass extends ActivityInstrumentationTestCase2 {
public static boolean myVar = true;
private static final String TARGET_PACKAGE_ID = "com.xxxx.test";
private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = "com.xxxx.test";
private static Class launcherActivityClass;
...
...
private String getOnScreeninfoByType() {
ArrayList<TextView> textViews = new ArrayList<TextView>();
ArrayList<Button> listButtons = new ArrayList<Button>();
ArrayList<ToggleButton> listToggleButtons = new ArrayList<ToggleButton>();
ArrayList<EditText> listEditTexts = new ArrayList<EditText>();
ArrayList<CheckBox> listCheckBoxes = new ArrayList<CheckBox>();
ArrayList<RadioButton> listRadioButtons = new ArrayList<RadioButton>();
ArrayList<ImageButton> listImageButtons = new ArrayList<ImageButton>();
ArrayList<ImageView> listImageViews = new ArrayList<ImageView>();
ArrayList<ProgressBar> listProgressBars = new ArrayList<ProgressBar>();
...
}
thanks
Upvotes: 6
Views: 3228
Reputation: 28767
They are not aligned because they should not be aligned!
The special alignment in the class, could be caused by a special non standard formating rule, that was set up by the person which created that project.
Look in project settings in eclipse under Code Formatter (or simillar)
Upvotes: 1
Reputation: 29468
There is an option Align Fields in Columns
in Preferences > Java > Code Style > Formatter > Edit > Indentation
. If this option is checked, fields in class are aligned as you saw. However, I couldn't find any options Align Local Variables
or something like that. It seems that there is no option to align local variables in columns.
Upvotes: 5