In Android Studio, autocompleting a layout tag automatically inserts layout_width and layout_height attributes.
Typing this:
<Tex
and hitting Enter gives me this:
<TextView android:layout_width="" android:layout_height="" />
and locks my cursor in the layout_width attribute, destroying my typing flow and requiring me to escape and manually format the tag.
These attributes are required to be present, and Android Studio is smart enough to say as much, so I'm not even capable of making the mistake they're trying to correct. Is there a way to force autocomplete to insert only the tag name, without attributes?
File -> Settings -> Editor -> Smart Keys -> Uncheck Automatically insert required attributes
However, you should use space instead of pressing enter to do the autocomplete as pressing enter would close the tag (unchecking not to insert closing tag didn't work for me in this case).
If using space you can also uncheck Automatically start attribute depending on your needs. With this checked it will add a ="" to allow to start typing in an attribute.

Edit
For using the space key to autocomplete:
File -> Settings -> Editor -> Code Completion -> Check Insert selected variant by typing dot, space, etc.
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