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:
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.
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.
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.
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
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>
Just apply your image using android:background="@drawable/image"
as one of the button properties in the xml file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With