简体   繁体   中英

How can I create a chat bubble with stroke

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?

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM