vector 写的play/pause按钮
效果图:
具体代码:
drawable/bg_icon_play.xml
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:aapt=
"http://schemas.android.com/aapt"
android:width=
"20dp"
android:height=
"24dp"
android:viewportWidth=
"20"
android:viewportHeight=
"24">
<path
android:pathData=
"M19.47 11.03C20.17 11.46 20.17 12.53 19.47 12.96L1.57 23.84C0.87 24.27 0 23.74 0 22.88L0 1.11C0 0.25 0.87 -0.28 1.57 0.15L19.47 11.03Z"
android:fillColor=
"#FFFFFF"
android:fillAlpha=
"1"
android:fillType=
"evenOdd"/>
</vector>
drawable/bg_icon_pause.xml
<!-- res/drawable/ic_pause_rounded.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<!--
pathData 中的 M6,19h4V5H6v14zm8-14v14h4V5h-4z 定义了两个垂直的矩形,表示暂停按钮
通过使用 a2,2 来创建圆角效果,确保矩形的每个角都是圆的。
-->
<path
android:fillColor="#FFF"
android:pathData="M4,2h4a2,2 0 0,1 2,2v16a2,2 0 0,1 -2,2h-4a2,2 0 0,1 -2,-2V4a2,2 0 0,1 2,-2zM16,2h4a2,2 0 0,1 2,2v16a2,2 0 0,1 -2,2h-4a2,2 0 0,1 -2,-2V4a2,2 0 0,1 2,-2z" />
</vector>