1.圆角按钮
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"><shape> <solid android:color="#8CD6F5" /> <corners android:radius="4dp" /> <stroke android:width="1dp" android:color="#8CD6F5" /> </shape></item> <item><shape> <solid android:color="#0BADEC" /> <corners android:radius="4dp" /> <stroke android:width="1dp" android:color="#0BADEC" /> </shape></item> </selector>
2.灰色方框
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <stroke android:width="1dip" android:color="#88000000" /> <corners android:radius="1dip" > </corners> <gradient android:centerColor="#00FFFFFF" android:endColor="#00FFFFFF" android:startColor="#00FFFFFF" /> </shape>
3.半圆按钮 比较全面
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="true" android:state_window_focused="false"><shape android:shape="rectangle"> <stroke android:width="1px" android:color="#00000000" /> <corners android:topLeftRadius="5dp" android:topRightRadius="5dp" /> <gradient android:centerColor="#00A490" android:endColor="#00A490" android:startColor="#00A490" /> <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" /> </shape></item> <item android:state_pressed="true"><shape android:shape="rectangle"> <stroke android:width="1px" android:color="#00000000" /> <corners android:topLeftRadius="5dp" android:topRightRadius="5dp" /> <gradient android:centerColor="#00A490" android:endColor="#00A490" android:startColor="#00A490" /> <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" /> </shape></item> <item android:state_checked="true"><shape android:shape="rectangle"> <stroke android:width="1px" android:color="#00000000" /> <corners android:topLeftRadius="5dp" android:topRightRadius="5dp" /> <gradient android:centerColor="#00A490" android:endColor="#00A490" android:startColor="#00A490" /> <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" /> </shape></item> <item android:state_focused="true"><shape android:shape="rectangle"> <stroke android:width="1px" android:color="#00000000" /> <corners android:topLeftRadius="5dp" android:topRightRadius="5dp" /> <gradient android:centerColor="#00A490" android:endColor="#00A490" android:startColor="#00A490" /> <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" /> </shape></item> <item><shape android:shape="rectangle"> <stroke android:width="1px" android:color="#55000000" /> <corners android:topLeftRadius="5dp" android:topRightRadius="5dp" /> <gradient android:centerColor="#FFFFFF" android:endColor="#FFFFFF" android:startColor="#FFFFFF" /> <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" /> </shape></item> </selector>> from eoe.cn 原文链接:https://www.f2er.com/xml/298883.html