一个正常的气泡基本可以分为两个部分,一个是三角形,一个是正常的带圆角的长方形,先写一个正三角形:
<?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="20dp android:height="20dp" />
<solid android:color="#ffffff" />
</shape>
</rotate>
</item>
</layer-list>
长方形的shape就不写了,气泡的三角形也有可能在下面,所以写一个倒三角形:
<?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="20dp" android:height="20dp" />
<solid android:color="#ffffff" />
</shape>
</rotate>
</item>
</layer-list>
再用线性布局或者相对布局组合一下就可以了