2

I have the following code:

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
       <stroke android:color="@color/conversation_border" android:width="1dp"/>
       <solid android:color="@color/conversation_is_user_bg"/>
            <corners android:radius="1dp" />
            <padding android:left="7dp" android:top="1dp" android:right="1dp" android:bottom="7dp"/>  
</shape>

When i apply it to TextView, all is OK. but when i replace

<corners android:radius="1dp" />

with

<corners android:bottomLeftRadius="8dp"
          android:topLeftRadius="0"
          android:topRightRadius="0"
          android:bottomRightRadius="0" />

I have anexception. I already tried not to remove android:radius attribute, provide radius in px and dp, and result is always

error!
UnsupportedOperationException: null

which is very descriptive. What am I doing wrong and how to round only bottom left corner of the text view?

Raiv
  • 5,731
  • 1
  • 33
  • 51
  • That is a bug in android ,this code will work perfectly in android devices running on version 2.2 or above . – Sandeep Jul 29 '11 at 12:15
  • android 2.3.3 in emulator, r2 – Raiv Jul 29 '11 at 12:16
  • i was having the same problem in android 1.6 device but worked perfectly in 2.2 – Sandeep Jul 29 '11 at 12:20
  • hmm... i'll try it with other versions and post you back if it is working or not – Raiv Jul 29 '11 at 12:21
  • It will not work in emulator. Try on device. – PravinCG Jul 29 '11 at 12:21
  • 1
    check this link http://code.google.com/p/android/issues/detail?id=9161 – Sandeep Jul 29 '11 at 12:31
  • yes,that was a bug in android. i misspelled version of emulator, I has r1, not r2 here. And after upgrade to r2 it works fine, yet with inverted corners as in your link, but at least it shows corners. Thank you! – Raiv Jul 29 '11 at 12:38
  • there is a similar question http://stackoverflow.com/questions/6003382/how-can-i-work-around-android-issue-9161-where-bottomrightradius-and-bottomleftr – Sandeep Jul 29 '11 at 12:40
  • the worst disappointment in google i has was it's buggy development environment... :( After visual studio it is awful. – Raiv Jul 29 '11 at 12:52

4 Answers4

1

Just leave one option:

<corners 
    android:bottomLeftRadius="8dp"
/>
pawelzieba
  • 16,082
  • 3
  • 46
  • 72
1

try this one...

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/corners_blue_random">
    <solid android:color="@color/conversation_is_user_bg" />
    <corners android:radius="1dip" android:bottomLeftRadius="8dip"
        android:topLeftRadius="1dip" android:bottomRightRadius="1dip"
        android:topRightRadius="1dip" />
    <stroke android:color="@color/conversation_border"
        android:width="1dp" />
</shape>
Niranj Patel
  • 32,980
  • 10
  • 97
  • 133
1

That was a bug in android emulator, thanks to all who answered. After updating emulator to latest version all is working without modifications (exept this bug , but there is walkaround for it)

Raiv
  • 5,731
  • 1
  • 33
  • 51
0

try with below code:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <corners android:bottomLeftRadius="8dip"
        android:topLeftRadius="1dip" android:bottomRightRadius="1dip"
        android:topRightRadius="1dip" />

</shape>
ilango j
  • 5,967
  • 2
  • 28
  • 25