0

I want to make a view with just the top corners rounded.

This is the XML I have now:

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

But it doesn't work as expected (the bottom corners keep being rounded). How can I make an XML with just the top corners rounded?

RominaV
  • 3,335
  • 1
  • 29
  • 59
Hasan
  • 60
  • 1
  • 9
  • I think it would be useful to post how you're trying to apply this XML to your view. The problem may be there, according to this answer http://stackoverflow.com/a/8931327/2819864 the XML is correct. – RominaV Nov 04 '16 at 23:47

1 Answers1

1

If You want to create only one rounded corner button then you do like this and if you want to change then you just change the corner radius. This is not display properly when design but when you run then it's work fine.i hope this will help you.
This is top left and right corner is rounded and bottom left and right is not rounded. top_left_right_corner_rounded.xml

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

    <solid android:color="@color/colorPrimary"/>

    <corners
        android:radius="3dp"
        android:bottomRightRadius="0dp"
        android:bottomLeftRadius="0dp"
        android:topLeftRadius="5dp"
        android:topRightRadius="5dp"/>
</shape>
Farmer
  • 4,093
  • 3
  • 23
  • 47