add selectable background style

dev
xufuji456 3 years ago
parent efd979b8fa
commit 8f700cca1a
  1. 9
      app/src/main/res/drawable/btn.xml
  2. 8
      app/src/main/res/drawable/btn_circle.xml
  3. 8
      app/src/main/res/drawable/btn_point.xml
  4. 10
      app/src/main/res/drawable/btn_rect.xml
  5. 13
      app/src/main/res/drawable/btn_rect_normal.xml
  6. 13
      app/src/main/res/drawable/btn_rect_selected.xml
  7. 6
      app/src/main/res/drawable/white_background.xml

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--空心圆角矩形 -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="10dp" /><!-- 圆角半径 -->
<gradient
android:endColor="@color/colorPrimary"
android:startColor="@color/colorAccent" /><!-- 矩形的内部颜色,这里设置成白色,即空心 -->
</shape>

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--空心圆角矩形 -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="30dp" /><!-- 圆角半径 -->
<corners android:radius="30dp" />
<stroke
android:width="1dp"
android:color="@color/colorBord" /><!--矩形的边线 -->
android:color="@color/colorBord" />
<size
android:height="60dp"
android:width="60dp" /><!--矩形的宽高 -->
android:width="60dp" />
</shape>

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--空心圆角矩形 -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="20dp" /><!-- 圆角半径 -->
<corners android:radius="20dp" />
<size
android:height="40dp"
android:width="40dp" /><!--矩形的宽高 -->
android:width="40dp" />
<gradient
android:endColor="@color/redBtn"
android:startColor="@color/redBtn" /><!-- 矩形的内部颜色,这里设置成白色,即空心 -->
android:startColor="@color/redBtn" />
</shape>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:drawable="@drawable/btn_rect_selected" />
<item android:drawable="@drawable/btn_rect_normal" />
</selector>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="6dp" />
<stroke
android:width="1dp"
android:color="@color/colorAccent" />
<size
android:height="40dp"
android:width="100dp" />
</shape>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="6dp" />
<stroke
android:width="1dp"
android:color="@color/colorAccent" />
<size
android:height="40dp"
android:width="100dp" />
<solid android:color="@color/colorAccent"/>
</shape>

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--空心圆角矩形 -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="10dp" /><!-- 圆角半径 -->
<corners android:radius="10dp" />
<gradient
android:endColor="@android:color/white"
android:startColor="@android:color/white" /><!-- 矩形的内部颜色,这里设置成白色,即空心 -->
android:startColor="@android:color/white" />
</shape>
Loading…
Cancel
Save