Android Ring Button

I want to create a button background (or the button itself) that will look like the one shown below.

enter image description here

I am doing this currently with an image. I tried to create one using the following XML, but it doesn’t look as expected.

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="#f0600000"/> <stroke android:width="10dp" android:color="#FFFF6666"/> </shape> 

In fact, I want a round button with a 3 pixel shadow and 1/4 width in red around the white circle. I failed with the shadow part at all. Thanks for any help.

+4
source share
1 answer

Well, a solid fills the middle, and a stroke colors the border. Since you need 3 colors, you will have to use 2 drawings, painting a white circle in a red circle with a gray frame. Then you can use LayerDrawable to save them as one unit

0
source

Source: https://habr.com/ru/post/1395055/


All Articles