扁平化按钮"

效果图:

Android Every day a new function:one-LMLPHP

代码:

 <?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="#79a84b"/>
<corners android:radius="8dp"/>
</shape>
</item>
<item android:state_pressed="false">
<shape >
<solid android:color="#9ad060"/>
<corners android:radius="8dp"/>
</shape>
</item>
</selector>

设置背景即可(Android自定义button样式,参考:http://blog.csdn.net/maigan323/article/details/7026644)。

05-02 15:54