0

In My application i am Creating rounded border using this code:

<?xml version="1.0" encoding="UTF-8"?> 
<shape      
     xmlns:android="http://schemas.android.com/apk/res/android">     
     <stroke          
            android:width="1dip"          
            android:color="#ffffff"/>     
     <solid
            android:color="#95865F"/>
     <corners
            android:radius="10px"
            android:topRightRadius="0dp"
            android:bottomRightRadius="0dp" />
     <padding
            android:left="1dp"
            android:right="1dp"
            android:top="1dp"
            android:bottom="1dp"/>

While i am doing this all works well but in eclipse in GraphocalLayout i see the error message like below image. enter image description here

Whats wrong in this ? And i want to remove this message then what should i have to do ? Thanks.

Shreyash Mahajan
  • 23,386
  • 35
  • 116
  • 188
  • Did you tried removing `android:radius="10px"` and adding `topLeftRadius` and `bottomLeftRadius`? – SERPRO Dec 08 '11 at 13:17
  • You can also try increasing the stroke:width. I seem to recollect running into this once and I think that did it for me. – Code Poet Dec 08 '11 at 13:22
  • After http://stackoverflow.com/questions/8399517/why-i-am-not-able-to-create-the-round-border-for-specific-corner : did it work on real device and not with the graphical layout preview? – Renaud Dec 08 '11 at 17:36
  • @Renaud: it works in to realy devise as well in emulator but not in the GraphicalLayout of the Eclipse android Project development. So whats the sollution for it ? – Shreyash Mahajan Dec 09 '11 at 09:02

2 Answers2

1

With Indigo and ADT 15 from scratch, here is the result:

Eclipse capture

I obtain that with a drawable/cornered_bg.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <stroke          
            android:width="10dip"          
            android:color="#ffffff"/>     
     <solid
            android:color="#95865F"/>
     <corners
            android:radius="100px"
            android:topRightRadius="0dp"
            android:bottomRightRadius="0dp" />
     <padding
            android:left="1dp"
            android:right="1dp"
            android:top="1dp"
            android:bottom="1dp"/>
</shape>

and a layout/main.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@drawable/cornered_bg">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

</LinearLayout>

Changing the android:radius value does work… but all the corners are rounded (it's OK on a real device).

Certainly a limitation of the graphical layout. I suggest you to search and browse http://code.google.com/p/android/issues/list and http://tools.android.com/knownissues. I have found nothing related to this problem, so give it a try and if you find nothing, you could open a ticket.

Renaud
  • 8,783
  • 4
  • 32
  • 40
0

Try the following:

<?xml version="1.0" encoding="UTF-8"?> 
<corners
        android:topLeftRadius="10px"
        android:topRightRadius="0dp"
        android:bottomLeftRadius="10px"
        android:bottomRightRadius="0dp" />
wrren
  • 1,281
  • 9
  • 11