मुझे XML का उपयोग करके एक साधारण गोलाकार आयत बनाने में परेशानी हो रही है। एंड्रॉयड पर android.graphics.Path.addRoundRect (Path.java:514) परएंड्रॉइड - सरल आयताकार आकार नहीं बना सकता ... असमर्थितऑपरेशन अपवाद?
java.lang.UnsupportedOperationException : हर बार जब मैं कस्टम आकार मैं पाने के लिए तत्व "कोनों" जोड़ने की कोशिश .graphics.drawable.GradientDrawable.draw (GradientDrawable.java:314) android.view.View.draw (View.java:6520) पर ...
रेस/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>
सरल ऊपर आकार का उपयोग करते हुए layout.xml:
<?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 करें, मैं Android 2.1 के लिए संकलित करने के लिए कोशिश कर रहा हूँ और मैं सभी नवीनतम अद्यतन ग्रहण करने के लिए स्थापित और एंड्रॉयड एसडीके की है। यह आकार किसी अन्य वेबसाइट पर देखी गई किसी चीज़ की सीधी प्रति है, लेकिन किसी कारण से यह मेरे लिए काम नहीं करना चाहता है।
धन्यवाद।
आकार तत्व और इसके गुण यहां देखें: http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape – vanna