Rounded android button can be used for many purposes to make awesome application. We can see many applications that have used circle button or rounded corner. In this tutorial, I am going to show how to make circular android button and to add icons/images and text in the same button.
To make circular button in android app, you don’t need any java code, this can be done by using only XML. Rounded button can also be created by using java code but it is time consuming and need to have advance knowledge of java programming.
Here you will learn to make circular/rounded corner button using XML only.
Related:
Android Button with Icon and Text
Adding Badge (Item Count) to Android Button
Android Switch Button Example
First you have to create a new XML file in drawable folder to make rounded button. In this file I have made a rectangle and gave border radius to make circular and fill the background and border color. Following is the complete content of XML drawable file.
res/drawable/ circle.xml
This is the XML layout file where I have added different buttons with image and text together and set background to the drawable file that we have created above. Following is the complete content of XML layout file.
res/layout/circular_button_with_image_and_text.xml
Following is the default code of java activity file.
src/ RoundedAndroidButton.java
res/values/strings.xml
Now, run your Circular Button with Icon and Text in Android application which will look like above screenshot. If you have any question please mention in the comment box below.
To make circular button in android app, you don’t need any java code, this can be done by using only XML. Rounded button can also be created by using java code but it is time consuming and need to have advance knowledge of java programming.
Here you will learn to make circular/rounded corner button using XML only.
Related:
Android Button with Icon and Text
Adding Badge (Item Count) to Android Button
Android Switch Button Example
Android Example: How to Create Circular Button with Icon and Text in Android
First you have to create a new XML file in drawable folder to make rounded button. In this file I have made a rectangle and gave border radius to make circular and fill the background and border color. Following is the complete content of XML drawable file.
res/drawable/ circle.xml
XML Layout File
This is the XML layout file where I have added different buttons with image and text together and set background to the drawable file that we have created above. Following is the complete content of XML layout file.
res/layout/circular_button_with_image_and_text.xml
Java Activity File
Following is the default code of java activity file.
src/ RoundedAndroidButton.java
Strings.xml File
res/values/strings.xml
Now, run your Circular Button with Icon and Text in Android application which will look like above screenshot. If you have any question please mention in the comment box below.
Comments
Post a Comment