To make a button round we can first make a shape.xml in our drawable folder
shape.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<stroke
android:width="6dp"
android:color="#FFFFFF" />
<solid android:color="#FF66B2" />
<corners
android:bottomLeftRadius="45dp"
android:bottomRightRadius="45dp"
android:topLeftRadius="45dp"
android:topRightRadius="45dp" />
</shape>
This shape can be used as a background of the button:
<Button
android:id="@+id/round1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/round_button"
android:gravity="center" />
Subscribe to:
Post Comments (Atom)
You make shape.xml... but you are using round_button in this line :
ReplyDeleteandroid:background="@drawable/round_button"
Where is that round_button coming from...??
It should be "drawable/round1"
ReplyDeleteWorst explanation wasted my time.
ReplyDelete