如何使用壁画向图像显示气泡?

时间:2017-08-27 09:48:20

标签: android chat fresco

我只是做一个聊天应用,并希望为每个对话图像添加气泡bubble effect ,我使用Fresco下载图像。如何使用Fresco添加图像气泡?

1 个答案:

答案 0 :(得分:0)

要创建聊天气泡,您必须在某个图像编辑器中创建气泡图像,然后从中创建一个9Patch。您还可以使用形状创建气泡,然后将其保存为可绘制的,然后可以使用。使用形状的聊天气泡的示例是:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

<item android:top="50dp">
    <rotate
        android:fromDegrees="-45"
        android:pivotX="0%"
        android:pivotY="0%"
        android:toDegrees="0" >
        <shape android:shape="rectangle" >
            <solid android:color="#e57605" />
        </shape>
    </rotate>
</item>
<item android:left="20dp">
    <shape android:shape="rectangle" >
        <solid android:color="#e57605" />

        <corners android:radius="20dp" />
    </shape>
</item>
</layer-list>

结果图片将是:

enter image description here