I am new to working with XML and am editing a layout in my Android app and it is giving me the error "XML has empty body" is anyone able to tell me what I have done wrong? This is my code:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/orange"></solid>
<stroke
android:width="2dp"
android:color="@color/orange"></stroke>
<padding
android:bottom="10dp"
android:left="15dp"
android:right="15dp"
android:top="15dp"></padding>
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:radius="1dp"
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
Thanks
Edit: had to add spaces to make first 2 lines appear...
It appears to have worked by getting rid of the closing tags and replacing them with the self closing tags:
<solid android:color="@color/orange" />
<stroke
android:width="2dp"
android:color="@color/orange" />
<padding
android:bottom="10dp"
android:left="15dp"
android:right="15dp"
android:top="15dp" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:radius="1dp"
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
Replace the tag
<solid android:color="@color/orange"></solid>
instead of
<solid android:color="@color/orange"/>
//like wise all tags
Replacing < include layout = "@layout/layout> < /include> with: < include layout = "@layout/layout /> worked fine for me.
Just place the closing tag on a new line, for example replace:
<solid android:color="@android:color/white"></solid>
with:
<solid android:color="@android:color/white">
</solid>
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