版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qingfeng812/article/details/51601317
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true"> <layer-list> <item android:bottom="0.5dp" android:top="-1dp" android:left="-1dp" android:right="-1dp"> <shape> <solid android:color="#00F5FF" /> <stroke android:width="0.5dp" android:color="#00F5FF" /> </shape> </item> </layer-list> </item> <item android:state_pressed="true"> <layer-list> <item android:bottom="0.5dp" android:top="-1dp" android:left="-1dp" android:right="-1dp"><shape> <solid android:color="#00F5FF" /> <stroke android:width="0.5dp" android:color="#00F5FF" /> </shape> </item> </layer-list> </item> <item> <layer-list> <item android:bottom="0.5dp" android:top="-1dp" android:left="-1dp" android:right="-1dp"> <shape> <solid android:color="#00F5FF" /> <stroke android:width="0.5dp" android:color="#949494" /> </shape> </item> </layer-list> </item> </selector>
概要:
实现单边框主要是layer-list item中bottom,top,left,right四种属性!