I'm building a chat app and I need to create chat bubbles like this in the image. I need to show/hide the light green stroke around the bubble. I'm able to achieve the chat bubble shape drawable with the help of this post. How can I add such stroke around the chat bubble?
Asked
Active
Viewed 241 times
1 Answers
0
You can use <stroke/>
which should be placed inside the <shape></shape>
tag inside your drawable. There is no way to directly show and hide the green stroke, only if you make two identical drawables, one with stroke and one without, or use color state list (through <selector/>
) for stroke color (transparent and green for two different states) which can later be changed in your code. (For example android:state_selected
, it's available for AppCompatImageButton
as isSelected
in your code)

Tamim Attafi
- 2,253
- 2
- 17
- 34
-
I solved the issue using 9-patch image. Thanks for your response – Sreehari K Sep 15 '22 at 13:56