Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Round button in Android

I want to create a circular button having a plus and minus sign on to this and exactly used in Android Contacts application like shown in the image as below:

alt text

like image 556
Vikas Patidar Avatar asked Oct 12 '10 11:10

Vikas Patidar


People also ask

What is round button?

Detailed Description. RoundButton is identical to Button, except that it has a radius property which allows the corners to be rounded without having to customize the background. RoundButton { text: "\u2713" // Unicode Character 'CHECK MARK' onClicked: textArea.

What is rounded app on Android?

Android 12 introduces Rounded Corner API that enables you to get the properties of a screen's rounded corners, such as its center and its radius. As you can see in the image above, with this API you app can be made aware of the screen's rounded corner and avoid truncating the UI elements.

Why rounded buttons are better?

Buttons with rounded corners are easier on the eyes than a rectangle with sharp edges because they take less cognitive effort to visually process. Scientific research done on corners by the Barrow Neurological Institute found that the “perceived salience of a corner varies linearly with the angle of the corner.

What is rounded rectangle on Android?

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >


2 Answers

You may see implementation of this button in android source code

It's just ImageButton with circular png as background. Here is definition of their styles:

<style name="MinusButton">
    <item name="android:background">@drawable/btn_circle</item>
    <item name="android:src">@drawable/ic_btn_round_minus</item>
    <item name="android:contentDescription">@string/description_minus_button</item>
</style>

<style name="PlusButton">
    <item name="android:background">@drawable/btn_circle</item>
    <item name="android:src">@drawable/ic_btn_round_plus</item>
    <item name="android:contentDescription">@string/description_plus_button</item>
</style>
like image 190
Sergey Glotov Avatar answered Oct 04 '22 01:10

Sergey Glotov


Just apply your image using android:background="@drawable/image" as one of the button properties in the xml file

like image 27
Dustfinger Avatar answered Oct 04 '22 01:10

Dustfinger