简体   繁体   中英

Creating a custom round button in android

Can anyone help me out here. I am trying to create a small round button that would represent a lottery ball using a very simple self created XML class round_button.xml. However I keep getting the error over and over even when Ive put the code through a w3schools validator that " Error parsing XML: junk after document element." I cannot see what the issue is here and maybe I am missing something very clear, I dont know. Could anyone please help me out. Here is the code:

<?xml version="1.0" encoding="utf-8"?>
<shape 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval" />
    <solid
        android:color="#FF0000" 
</shape>    

You are just missing a bit of concept of closing the tags. You have extra / over android:shape="oval" /> . You are already closing the tag at the end with </shape> so no need to use /> .

Secondly you haven't ended <solid tag with /> . So try something like:

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval" >
    <solid
        android:color="#FF0000" />
</shape>    

You messed up tags. You have closed shape before end and not closed solid tag. Try this one.

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval" 
>
    <solid android:color="#FF0000" />
</shape>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM