创建圆角三角形

Create triangle with rounded corners

我需要创建圆角三角形。这是我的代码

<item android:gravity="center">
    <rotate
        android:fromDegrees="45"
        android:pivotX="-40%"
        android:pivotY="87%"
        android:toDegrees="45" >
        <shape android:shape="rectangle" >
            <corners android:radius="2dp"/>
            <solid android:color="#ffffff" >
            </solid>

            <stroke
                android:color="#ffffff" />

        </shape>

    </rotate>
</item>

用我的代码只有三角形的一侧是圆的,其他两个角不是圆的。请帮我创建一个所有角都圆角的三角形。

triangle.xml创建为res/drawable

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:height="50dp"
        android:width="50dp"
        android:viewportHeight="16.0"
        android:viewportWidth="16.0" >
    <path android:fillColor="@color/colorAccent" 
          android:pathData="M11.844,9.04L8.345,5.163c-0.195,-0.217 -0.511,-0.217 -0.705,0l-0.012,0.02L4.136,9.04c-0.195,0.217 -0.195,0.569 0,0.786l0.006,0.005C4.233,9.936 4.358,10 4.499,10h6.983c0.143,0 0.27,-0.068 0.359,-0.176l0.002,0.002C12.039,9.609 12.039,9.257 11.844,9.04z"/>
</vector>

改变三角形的颜色android:fillColor

并使用@drawable/triangle

这很简单.... 因为简单的可绘制对象没有形状修改的高级功能。