XML tag <space> not accepted in a layout file (Android Studio)

351 Views Asked by At

his is my first entry in StackOverFlow and my first steps with Android-Studio, with a hopefully not too severe problem.

The use of the tag is offered, but after insertion it is marked red as an error. The behaviour occurs regardless of the layout type.

1

I am not clear why this is marked as an error.

I have tried to use other layouts.

My expectation:

The tag is not marked as an error.

2

There are 2 best solutions below

0
Angel Koh On BEST ANSWER

If you hover over the error, you'd notice a popup appearing. In this case, you are missing 2 compulsory attributes (width and height). adding them will remove the error.

enter image description here

0
laalto On

Space like any other view in a XML layout has some mandatory attributes you are not providing: android:layout_width and android:layout_height. Omitting these produces the red error underline.