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
Stephen Murby
  • 1,407
  • 3
  • 17
  • 37
  • I am aware of a number of similar questions, previous answer being the XML namespace being incorrect, and 'xmlns:android="http://schemas.android.com/apk/res/android" ' needing to be in the root element. So I am not sure what the issue with mine is? – Stephen Murby Jul 06 '13 at 14:37
  • remove stuff till it works :-) remove the gradient / the comments / try a square shape, try just a selector ..... etc – Blundell Jul 06 '13 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? :) http://stackoverflow.com/a/2470289/833647 – Ken Wolf Jul 06 '13 at 14:42
  • Supposed to be a round button, I followed a tutorial to create the drawable from the internet. http://www.vogella.com/articles/AndroidDrawables/article.html#drawables_shape – Stephen Murby Jul 07 '13 at 15:09

0 Answers0