2

I am trying to make dialog with round corner button. but it's not working below API_LEVEL14

I am trying this but there is no solution. If you have any solution for below api-14 then share it.

for below API 14 it's show like

enter image description here

and it's works well api level 14 and above

enter image description here

for right_below_corner.xml

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

    <item android:state_enabled="false"><shape android:shape="rectangle">
            <solid android:color="@color/header_bg_disable" />
            <corners android:topLeftRadius="0dp" />
            <corners android:topRightRadius="0dp" />
            <corners android:bottomLeftRadius="0dp" />
            <corners android:bottomRightRadius="10dp" />
            <stroke android:width="1dp" android:color="@color/header_bg_disable" />
            <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" />
        </shape></item>
    <item android:state_pressed="true"><shape android:shape="rectangle">
            <solid android:color="@color/header_bg_press" />
            <corners android:topLeftRadius="0dp" />
            <corners android:topRightRadius="0dp" />
            <corners android:bottomLeftRadius="0dp" />
            <corners android:bottomRightRadius="10dp" />
            <stroke android:width="1dp" android:color="@color/header_bg_press" />
            <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" />
        </shape></item>
    <item android:state_pressed="false"><shape android:shape="rectangle">
            <solid android:color="@color/header_bg" />
            <corners android:topLeftRadius="0dp" />
            <corners android:topRightRadius="0dp" />
            <corners android:bottomLeftRadius="0dp" />
            <corners android:bottomRightRadius="10dp" />
            <stroke android:width="1dp" android:color="@color/header_bg" />
            <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" />
        </shape></item>

</selector>

and for bottom_left_corner.xml is

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true"><shape android:shape="rectangle">
            <solid android:color="@color/header_bg_press" />
            <corners android:bottomLeftRadius="10dp" />
            <corners android:topLeftRadius="0dp" />
            <corners android:topRightRadius="0dp" />
            <corners android:bottomRightRadius="0dp" />
            <stroke android:width="1dp" android:color="@color/header_bg_press" />
            <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" />
        </shape></item>
    <item android:state_pressed="false"><shape android:shape="rectangle">
            <solid android:color="@color/header_bg" />
            <corners android:topLeftRadius="0dp" />
            <corners android:topRightRadius="0dp" />
            <corners android:bottomRightRadius="0dp" />
            <corners android:bottomLeftRadius="10dp" />
            <stroke android:width="1dp" android:color="@color/header_bg" />
            <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" />
        </shape></item>
</selector>
Community
  • 1
  • 1
Mr X
  • 1,053
  • 2
  • 11
  • 24
  • There is a workaround to achieve that. Add a view like `` which gives some extra gap at the bottom allowing the background to take a rounded corner – Logic May 15 '15 at 05:55
  • @AvinashChowdary i try this but not work. – Mr X May 15 '15 at 06:09

1 Answers1

1

Yes, there is a bug in Android up until version 3.1. When specifying the corners separately, the bottom left and right corners get flipped: http://code.google.com/p/android/issues/detail?id=9161

The only solution is to make separate xml-files for those 2 versions. Like this:

res/drawable/corners.xml – with the reversed values

res/drawable-v12/corners.xml – with the normal values

Oleg Cherr
  • 3,565
  • 2
  • 17
  • 27