Unexpected auto-formatting of XML layout in Android Studio - android

I am using AS since 4 years. After last update I observed unexpected auto-formatting of XML layout (while typing and with Code -> Reformat Code too).
Here is an example:
When I started typing relative layout, it expanded start tag, width property, height property and closing tag in the same line.
Properties starts after indentation.
No space between views after reformat.
Question
Is this a feature in new AS? then how can I revert it back?
Did I change some setting? What setting should I modify to revert back? (I tried to find on google but could not find anything)
I am using
Android Studio 3.2.1
Build #AI-181.5540.7.32.5056338, built on October 8, 2018

Update
if you facing same issue with Android Studio 3.5 please check below article
Android Studio 3.5 Upgrade XML Reformatting Problems
Open File > Settings > Editor > Code Style > XML
Now in layout file make sure you have selected wrap attributes as Wrap always
Like below screenshot:

for me it's working
Open Settings > Editor > Code Style > XML > Arrangements
Click Set from... text
Select Predefined Styles > Android
Click Apply button

Related

Android Studio XML code is folding my code automatically

i'm have a small problem with my android studio IDE, i've made some changes but don't remember exactly where i did made this change in the settings, the problem is that my xml code is always folded, and i want to know how i can change it to be unfolded by default as it should be.
Preferences > Editor > General > Code Folding > XML > XML tags: disable
For Android Studio 4.0 or above
Goto Settings or Press (Ctrl + Alt + S)
And Navigate to Editor = > Code Folding
And uncheck the option XML tags

Prevent android studio to create more than a tag in xml files

In the new android studio 3.3 or 3.2 if we create a for example button auto generate create a text like
<Button android:layout_width="" android:layout_height=""/>
but I would like something more like this
<Button
android:layout_width=""
android:layout_height=""/>
like old versions of Android studio is there a setting or something for that?
That is related to XML code wrapping. By default it should be on wrap always but maybe it's not in your Android Studio or they changed that in newer versions. Anyway you can find that by click on:
Preferences -> Code Style (expand it) -> XML -> Android(Tab) ->
Here you can find Layout Files and below options like: Wrap always, Don't wrap, Wrap if long etc. So set it on Wrap always and Apply changes and your XML code from now on should be wrapped.
It hints something that says reduce intent with 4 spaces. Try to configure that :)
Or use the hard way by pressing enter for the new row.

Xml files in Android Studio - Remove spaces inside tags in layout files

On Android Studio is there a way to remove unnecessary spaces between the attributes and 'end tags' (">" and "/>") when formating xml files?
I can't see this configuration "Code Style" options.
Based on the accept answer below I got a configuration that work for me:
In Android Studio's Preferences, go to Editor > Code Style > XML. Then select the Android tab on the far right. There are options in this tab to customize the formatting of Android XML files (manifest, layouts, etc.). Make sure Use custom formatting settings for Android XML files is checked. Then you can just format that file like you do any other file Code > Reformat Code.
To get rid of the space before closing tags, go to the Other tab. Under Spaces make sure In empty tag and After tag name are un-checked.

Android Studio, change the editor background color (not the whole theme)

The same question was marked as "duplicate" even though it obviously was not a duplicate. At least it should be obvious to anyone who is familiar with configuring an editor. When you want to change the background color, you aren't talking about changing the whole theme, you are talking about changing the background color.
Is there a way to change only the background color in Android Studio editor?
Sorry, but I believe you all have this one wrong. To change the background of the editor goto File, Settings, Editor, Colors & Fonts and select General. You'll see an item called "Default text". On the right of the window you will see a checkbox for background. Click in the color window and choose whichever color you prefer. Now the entire editor window will show that color as the background.
go to : Android Studio > Preferences > Editor > Colors & Fonts > General
In Android Studio 3.2.1 Windows (latest version as of today - Nov 2, 2018), go to
File > Settings > Editor > Color scheme > General > Text-Default text. One can change foreground and background colors using the panel on the right.
One can change the bottom logcat panel colors similarly - go to
File > Settings > Editor > Color Scheme > Console Colors > Console (or log Console)
Yes it is. Open Settings (Preferences on a Mac) and under IDE Settings expand Editor, Colors & Fonts and select General. You'll see Background in a menu on the left side. Click on the checkbox next to it if it's not ticked already and then double click on the square filled with current background color to get the color picker.
AndroidStudio 3.3.2
1st step:
2nd step:
Android Studio 4.1.2 on Mac
File -> Preferences -> Editor -> Color Scheme -> General -> Text -> Default Text
None of the Answers above have correct info for Windows Android Studio 3.1.2.
On Mac, apparently this works: go to Android Studio > Preferences > Editor > Colors & Fonts > General, but we Windows folk don't have an Android Studio tab or option and Preferences isn't an option anywhere.
We have File > Settings > Editor. Here's the screen with the only conceivable next links to click highlighted:
But here's what I see when I click General. I can select this background:
But I can't live with that.
In Windows 7, AS 3.1.2 the menu sequence--File > Settings > Editor > Color scheme > General > Text > Default text--takes you to a screen where you can set the foreground and background colors via a "color circle" or by typing in your favorite RRGGBB code(s).
I was pleasantly surprised by how an error in an xml file showed up (and the current line):

Graphical Layout missing for xml layout file Android

I have opened up a android project but the xml file graphical layout is not being shown..I have searched on stack overflow and found that it can be fixed by clicking create in top right ..but it is greyed out and does not come up...even if i fill all the details of locale,editing config,change android API level to 2.2/3.0 ..The file opens in xml view..Screenshots are attached..
Can anyone let me know what is the problem and its solution.
If the answer is there somewhere on stack overflow..kindly provide the link..i will delete the question..i wasn't able to find the answer myself..
Open With > Android Common XML editor will not work.
The two tabs was missing because of the theme. Try to set your theme back to the default one. Eclipse > Preferences > General > Appearance > Theme combobox > Mac

Categories

Resources