绘制小尖角(真最简便快捷的方法!)
正三角
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/shape_id">
<!-- 正三角 -->
<rotate
android:fromDegrees="45"
android:toDegrees="45"
android:pivotX="-40%"
android:pivotY="80%">
<shape android:shape="rectangle">
<solid android:color="#000000"/>
</shape>
</rotate>
</item>
</layer-list>
倒三角
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/shape_id">
<!-- 倒三角 -->
<rotate
android:fromDegrees="45"
android:toDegrees="45"
android:pivotX="135%"
android:pivotY="15%"
>
<shape android:shape="rectangle">
<solid android:color="#000000"/>
</shape>
</rotate>
</item>
</layer-list>
使用
<ImageView
android:layout_width="18dp"
android:layout_height="18dp"
android:background="@drawable/shape_reverse_triangle"
/>
效果图
感谢大佬:(原文链接)
https://blog.youkuaiyun.com/u010356768/article/details/76040972