用shape结合selector实现点击效果
<span style="font-family:Arial, Helvetica, sans-serif;font-size:18px;background-color: rgb(255, 255, 255);">有时候美工为了省事。不给我们图片,没办法,也不能得罪美工呀,可是我们能够用颜色实现我们的点击效果呀!</span>
<span style="font-family: Arial, Helvetica, sans-serif;"><?xml version="1.0" encoding="UTF-8"?></span> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:angle="90" android:endColor="#ffff99" android:startColor="#ffff99" /> <corners android:radius="20dp" /> </shape>
<?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:angle="90" android:endColor="#cc3935" android:startColor="#cc3935" /> <corners android:radius="20dp" /> </shape>
<?xml version="1.0" encoding="utf-8"?自己动手,丰衣足食!> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/red_shape" android:state_pressed="true"/> <item android:drawable="@drawable/gray_shape"/> </selector>
!!
!
。!!!
。!