Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - Can't create simple rectangle shape... UnsupportedOperationException?
    text
    copied!<p>I'm having trouble creating a simple rounded rectangle using XML. Every time I try to add the "corners" element to the custom shape I get:</p> <blockquote> <p>java.lang.UnsupportedOperationException at android.graphics.Path.addRoundRect(Path.java:514) at android.graphics.drawable.GradientDrawable.draw(GradientDrawable.java:314) at android.view.View.draw(View.java:6520) ...</p> </blockquote> <p>res/dawable/rounded_rectangle.xml:</p> <pre><code> &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"&gt; &lt;solid android:color="#ffffff"/&gt; &lt;stroke android:width="3dp" android:color="#ff000000"/&gt; &lt;padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp"/&gt; &lt;corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" android:topLeftRadius="7dp" android:topRightRadius="7dp"/&gt; &lt;/shape&gt; </code></pre> <p>simple layout.xml using the above shape:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent"&gt; &lt;View android:id="@+id/View01" android:background="@drawable/rounded_rectangle" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/View&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Fyi, I'm trying to compile for Android 2.1 and I have all the latest updates installed to Eclipse and the Android SDK. This shape is a direct copy of something I saw on another website, but for some reason It doesn't want to work for me.</p> <p>Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload