Tags: Circle shape in XML drawable file Android, how to circle shape in xml in android, How to Circle shape in XML drawable file Android, Android circle shape in xml
Create res/drawble/circle_shape.xml
Create res/drawble/circle_shape.xml
<?xml version="1.0" encoding="utf-8"?>Create res/layout/activity_main.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid android:color="#e42828"/>
<stroke android:color="#3b91d7" android:width="5dp"/>
<!-- Set the same value for both width and height to get a circular shape -->
<size android:width="250dp" android:height="250dp"/>
</shape>
</item>
</selector>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
tools:context=".MainActivity"
android:background="#f0f7e7"
>
<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Circular Shape"
android:layout_centerInParent="true"
android:background="@drawable/circle_shape"
android:textColor="#fff"
/>
</RelativeLayout>
No comments:
Post a Comment