1.三角形
其实吧 这是俩个view.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.as.shape.MainActivity">
<ImageView
android:src="@drawable/triangle_up"
android:layout_marginLeft="20dp"
android:layout_width="20dp"
android:layout_height="20dp" />
<TextView
android:text="我是聊天内容"
android:layout_width="100dp"
android:background="@drawable/bg_rectangle_corner"
android:layout_height="50dp" />
</LinearLayout>
正三角
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 正三角 -->
<item>
<rotate
android:fromDegrees="45"
android:pivotX="-40%"
android:pivotY="80%">
<shape android:shape="rectangle">
<size
android:width="16dp"
android:height="16dp" />
<solid android:color="#7d72ff" />
</shape>
</rotate>
</item>
</layer-list>
倒三角
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 倒三角 -->
<item>
<rotate
android:fromDegrees="45"
android:pivotX="135%"
android:pivotY="15%">
<shape android:shape="rectangle">
<size
android:width="16dp"
android:height="16dp" />
<solid android:color="#7d72ff" />
</shape>
</rotate>
</item>
</layer-list>
2.矩形也就是上面那个圆角
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#7d72ff" />
<corners android:radius="6dp" />
</shape>
3.圆点
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#3F51B5" />
<stroke
android:width="10dp"
android:color="@color/colorAccent" />
</shape>
4.注意看这个是透明
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#003F51B5" />
<stroke
android:width="10dp"
android:color="@color/colorPrimary" />
</shape>