How to get around a form in Android

How can I achieve the round shape on Android, as shown below, using the Android form:

enter image description here

+51
android drawable shape
Apr 11 2018-12-12T00:
source share
1 answer

You need to create a drawable shape in the dropdown folder that looks something like this:

 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <gradient android:startColor="#FFFF0000" android:endColor="#80FF00FF" android:angle="270"/> </shape> 

(In this example, I saved drawable as circle.xml and it will have a gradient fill)

Then in your layout you need to define the view and set the form as the background:

 <View android:layout_width="50dp" android:layout_height="50dp" android:background="@drawable/circle"/> 

The view determines the size and dimensions of the form.

Edit - Screenshots of the code result

Graphical view

Code Image

+108
Apr 11 2018-12-12T00:
source share



All Articles