Full width home advertisement

Post Page Advertisement [Top]

How to create a circle/round button in android?

Step1: Create a drawable xml in res/drawable folder with name "button_round.xml"

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="oval"> <stroke android:color="#60d8ff" android:width="5dp" /> <solid android:color="#007aff"/> <size android:width="150dp" android:height="150dp"/> </shape> </item> </selector>


Step 2: Use this drawable in normal android button background to make it circular.
<Button android:id ="@+id/button1" android:layout_width="150dp" android:layout_height="150dp" android:text="Round Button" android:background="@drawable/button_round" android:padding="15dp" />

No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib