Android XML Bug [duplicate] - android

This question already has answers here:
Android studio 3.5 refactor issue
(9 answers)
Closed 3 years ago.
Reformat code in xml change UI Layout
Before Reformat code
After Reformat code
Please help me.

Just go to-:
Settings -> Editor -> Code Style -> XML-> Set From -> Predefined Style > Android.
if doesnot happen try fresh install not updating android studio.

Related

Is there any way to add layout tag using android studio? [duplicate]

This question already has answers here:
DataBinding templates for Android Studio?
(4 answers)
Closed 2 years ago.
I'm migrating an old android project to use the Android DataBinding library. The first step is adding the layout tag as the root tag of all layout files in the project.
Doing this manually is ready frustrating so I want to ask Is there any way I can do it automatically in Android Studio?
Similar to converting a layout file to use motion layout. Just right click on the layout file and hit the convert to motion layout option.
Thanks
Click on the bulb icon on the top and convert to data binding layout as shown in picture that i added

Unexpected XML View formatting Android Studio 3.5 [duplicate]

This question already has answers here:
Android studio 3.5 refactor issue
(9 answers)
Closed 3 years ago.
After updating Android Studio to 3.5 whenever I auto format code (cmd+opt+l) it changes the order of the view tags inside the xml.
So for example in a LinearLayout your views would move around
Found the solution:
Preferences -> Editor -> Code Style -> XML
Search for Set from on the top left.
Set from -> Predefined Style -> Android
Don't forget to apply your changes
Hope this helps someone

XML code formatting gives wrong arranging child views in LinearLayout Android Studio 3.5 [duplicate]

This question already has answers here:
Android studio 3.5 refactor issue
(9 answers)
Closed 3 years ago.
Menu -> Code -> Reformat Code
Previous Android Studio version, my hands are very used to click Ctl+Alt+L to format code whenever I have typed some code block. After I updated to Android Studio 3.5, I formatted the code in XML and it is giving me wrong arrangement of my views and destroying my design.
Here is the design before code reformatting.
After code reformatted (click -> Ctl+Alt+L), my views was shuffled in both design and xml code side. please see second picture.
It seems a bug and I already reported it to Google Issue Tracker.
I just got answer from one of my colleague. That works well.
Settings -> Editor -> Code Style -> XML-> Set From -> Predefined
Style > Android.

Android studio xml Editor Auto Complete is not working [duplicate]

This question already has an answer here:
Code completion does not work for External Library XML attributes (Android Studio)
(1 answer)
Closed 6 years ago.
title = description
xml editor auto complete not working in My CustomView.
but other views in working.
i tried invalid caches / restart .. but still not working
what should i do?
Thanks for help.
Few tricks :
1.Clean and Run
File -> Invalidate Caches / Restart... -> Select Invalidate and Restart
2.Turned off Power Save
File -> Power Save Mode
3. Delete .idea folder and all .iml and rebuild.
4.If this still didn't do the work,try changing your custom view's name to its original android view temporarily and use autocomplete inside, and then revert the view to its custom name.

Change Default Indentation in Android Studio & about the indentation terminology [duplicate]

This question already has answers here:
Changing the Style of Braces in Android Studio
(2 answers)
Closed 5 months ago.
Instead of
for (...){
code;
}
I want:
for (...)
{
code;
}
I want to change from the default style which is the first one, to the second style, in Android Studio. ALSO, could someone please tell me the terminology for each style? (if there is terminology for such things). Thanks!
In the newest Android IDE 1.2.1.1
You need to go to
File->Settings->Editor->Code Style->Java->Wrapping and Braces

Categories

Resources