Tengo problemas para crear un rectángulo redondeado simple utilizando XML. Cada vez que intento añadir el elemento "esquinas" a la forma personalizada me sale:Android: no se puede crear una forma de rectángulo simple ... UnsupportedOperationException?
java.lang.UnsupportedOperationException en android.graphics.Path.addRoundRect (Path.java:514) en androide .graphics.drawable.GradientDrawable.draw (GradientDrawable.java:314) en android.view.View.draw (View.java:6520) ...
res/dawable/rounded_rectangle.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#ffffff"/>
<stroke android:width="3dp"
android:color="#ff000000"/>
<padding android:left="1dp"
android:top="1dp"
android:right="1dp"
android:bottom="1dp"/>
<corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
</shape>
sencilla layout.xml usando la forma arriba:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<View android:id="@+id/View01"
android:background="@drawable/rounded_rectangle"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</View>
</RelativeLayout>
FYI, estoy tratando de compilar para Android 2.1 y tengo todas las últimas actualizaciones instaladas a Eclipse y el SDK de Android. Esta forma es una copia directa de algo que vi en otro sitio web, pero por alguna razón no quiere funcionar para mí.
Gracias.
Vea el elemento Shape y sus atributos aquí: http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape – vanna