Speech bubbles in android
android
Solution
Incoming message:
<?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="0%"
android:pivotY="0%" >
<shape android:shape="rectangle">
<solid android:color="@color/chat_message_background_incoming" />
</shape>
</rotate>
</item>
<item android:left="20dp">
<shape
android:shape="rectangle">
<solid android:color="@color/chat_message_background_incoming"/>
<corners
android:radius="1dp"
android:bottomLeftRadius="15dp"
android:bottomRightRadius="15dp"
android:topLeftRadius="5dp"
android:topRightRadius="15dp" />
</shape>
</item>
</layer-list>
Outgoing message:
<?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="100%"
android:pivotY="0%" >
<shape android:shape="rectangle">
<solid android:color="@color/chat_message_background_outcoming" />
</shape>
</rotate>
</item>
<item android:right="20dp">
<shape
android:shape="rectangle">
<solid android:color="@color/chat_message_background_outcoming"/>
<corners
android:bottomLeftRadius="15dp"
android:bottomRightRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="5dp" />
</shape>
</item>
</layer-list>
Hopefully, it would help
Problem
Hi I wanted to use speech bubbles as background images for my app. I came across this posted here Android drawable speech bubble The example starts from the right direction I wanted to achieve this in the opposite direction I have tried ``` <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:top="30dp"> <rotate android:fromDegrees="-45" android:pivotX="0%" android:pivotY="0%" android:toDegrees="0" > <shape android:shape="rectangle" > <solid android:color="#CCC" /> </shape> </rotate> </item> <item android:right="10dp"> <shape android:shape="rectangle" > <solid android:color="#CCC" /> <corners android:radius="5dp" /> </shape> </item> </layer-list> ``` But I'm unable to get it to work, any help would be greatly appreciated!