In Android L, XXRadius is used to set the rounded corner. The background image cannot be displayed,
Example of setting the control's background:
<Button android: id = "@ + id/btn1" android: layout_width = "100dp" android: layout_height = "50dp" android: text = "btn1" android: background = "@ drawable/btn1"/> <? Xml version = "1.0" encoding = "UTF-8"?> <Shape xmlns: android = "http://schemas.android.com/apk/res/android" android: shape = "rectangle"> <solid android: color = "# ffffffff"/> <corners android: topLeftRadius = "5dp" android: topRightRadius = "5dp"/> <padding android: top = "5dp"/> </shape> <! -- Cannot be displayed under Android L -->
<Button android: id = "@ + id/btn2" android: layout_width = "100dp" android: layout_height = "50dp" android: text = "btn2" android: background = "@ drawable/btn2"/> <shape xmlns: android = "http://schemas.android.com/apk/res/android" android: shape = "rectangle"> <solid android: color = "# ffffffff"/> <corners android: topLeftRadius = "5dp" android: topRightRadius = "5dp" android: bottomLeftRadius = "5dp" android: bottomRightRadius = "5 Dp "/> <padding android: top =" 5dp "/> </shape> <! -- Cannot be displayed under Android L -->
<Button android: id = "@ + id/btn3" android: layout_width = "100dp" android: layout_height = "50dp" android: text = "btn3" android: background = "@ drawable/btn3"/> <shape xmlns: android = "http://schemas.android.com/apk/res/android" android: shape = "rectangle"> <solid android: color = "# ffffffff"/> <corners android: radius = "5dp"/> <padding android: top = "5dp"/> </shape> <! -- Normal -->
<Button android: id = "@ + id/btn4" android: layout_width = "100dp" android: layout_height = "50dp" android: text = "btn4" android: background = "@ drawable/btn4"/> <? Xml version = "1.0" encoding = "UTF-8"?> <Selector xmlns: android = "http://schemas.android.com/apk/res/android"> <item> <shape android: shape = "rectangle"> <solid android: color = "@ android: color/white "/> <corners android: bottomLeftRadius =" 5dp "android: bottomRightRadius =" 5dp "/> <padding android: bottom = "5dp"/> </shape> </item> </selector> <! -- Normal -->
Summary:
(1) the shape contains XXRadius, which cannot be displayed under Android L.
(2) The selector contains XXRadius, which can be normally displayed under Android L.
(3) android: radius is used in the shape, which can be normally displayed under Android L.
(4) For compatibility, you can replace shape with selector.