{"id":2105,"date":"2020-02-22T16:16:54","date_gmt":"2020-02-22T06:16:54","guid":{"rendered":"https:\/\/learntodroid.com\/?p=2105"},"modified":"2020-02-22T16:17:01","modified_gmt":"2020-02-22T06:17:01","slug":"how-to-create-rounded-corners-for-a-button-in-android","status":"publish","type":"post","link":"http:\/\/10.0.0.14:32769\/how-to-create-rounded-corners-for-a-button-in-android\/","title":{"rendered":"How to Create Rounded Corners for a Button in Android"},"content":{"rendered":"\n
\"\"<\/figure><\/div>\n\n\n\n

Making buttons in your Android app look nice is an important part of the user experience. As you design and build your app you are likely to eventually want to create rounded corners for your buttons.<\/p>\n\n\n\n

Android offers a default button that is not always intuitive to style the way you want, in many cases you will even need to use drawables to get the look and feel you are after.<\/p>\n\n\n\n

To create a rounded corners for a button in Android you will need to:<\/strong><\/p>\n\n\n\n

  1. Create a Drawable for your Button<\/strong><\/li>
  2. Add a Rectangle Shape to your Drawable<\/strong><\/li>
  3. Set the Background Color in your Drawable<\/strong><\/li>
  4. Set the Radius of the Corners in your Drawable<\/strong><\/li>
  5. Apply the Drawable to your Button<\/strong><\/li>
  6. Add a Button to your Activity \/ Fragment Layout and Apply the Drawable to the Button<\/strong><\/li><\/ol>\n\n\n\n

    In this post I have included code samples for creating a button with rounded corners in Android which you can make use of in your Android app.<\/p>\n\n\n\n

    In addition to this I have included sections in this post about styling rounded buttons in different ways such as:<\/p>\n\n\n\n