一、改善btn点击背景样式
btn_bgcolor_normal btn_bgcolor_pressed
btn_selector_item
-
圆角矩形样式
-
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#3366cc"/>
<corners android:radius="7dip"/>
</shape><?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#bfbfbf"/>
<corners android:radius="7dip"/>
</shape>
-
圆形样式
-
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="88dp"
android:height="88dp" />
<stroke android:width="6dp"
android:color="@color/gold" /><solid android:color="@color/green" />
</shape><?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="88dp"
android:height="88dp" />
<stroke android:width="6dp"
android:color="@color/gold" />
<solid android:color="@color/black" /></shape>
-
使用
-
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false"
android:drawable="@drawable/btn_bgcolor_normal"/>
<item android:state_pressed="true"
android:drawable="@drawable/btn_bgcolor_pressed"/>
</selector>
android:background="@drawable/btn_selector_item" |