0

I have tried to create a new drawable 'circle_button.xml'

<?xml version="1.0" encoding="utf-8"?>
<!-- Created by Stephen Murby   [06.07.2013] -->
<!-- Documentation:     http://developer.android.com/guide/topics/resources/drawable-resource.html -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="ring"
    android:innerRadius="0px">  <!-- Dimension Value only NOT an Integer -->

    <!-- Use android:startColor for centre value, moving to android:endColor as the outer. -->
    <gradient 
        android:type="radial"/>

</shape>

This is located 'res/drawable/circle_button.xml'. I am then trying to create and instance of one in my 'activity_main.xml'.

How ever I receive these errors:

Error
Sat Jul 06 15:22:16 BST 2013
activity_fullscreen.xml: Failed to parse file .../res/drawable/circle_button.xml
Error
Sat Jul 06 15:22:16 BST 2013
activity_fullscreen.xml: Failed to convert @drawable/circle_button into a drawable
4
  • I am aware of a number of similar questions, previous answer being the XML namespace being incorrect, and 'xmlns:android="schemas.android.com/apk/res/android" ' needing to be in the root element. So I am not sure what the issue with mine is? Commented Jul 6, 2013 at 14:37
  • remove stuff till it works :-) remove the gradient / the comments / try a square shape, try just a selector ..... etc Commented Jul 6, 2013 at 14:40
  • I think your gradient is missing some attributes. Try adding startColor, endColor and gradientRadius, otherwise it doesn't know how to turn it into a drawable. What's it supposed to draw? :) stackoverflow.com/a/2470289/833647 Commented Jul 6, 2013 at 14:42
  • Supposed to be a round button, I followed a tutorial to create the drawable from the internet. vogella.com/articles/AndroidDrawables/… Commented Jul 7, 2013 at 15:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.