Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7525859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:40:11+00:00 2026-05-30T03:40:11+00:00

I want to create rounded buttons in an Android program. I have looked at

  • 0

I want to create rounded buttons in an Android program. I have looked at How to create EditText with rounded corners?

What I want to achieve is:

  1. Rounded Edge Buttons
  2. Change Button background/appearance on different states (Like Onclick, Focus)
  3. Use my own PNG for the background and not create a shape.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:40:13+00:00Added an answer on May 30, 2026 at 3:40 am

    You can do a rounded corner button without resorting to an ImageView.

    A background selector resource, button_background.xml:

    <?xml version="1.0" encoding="utf-8" ?> 
         <selector xmlns:android="http://schemas.android.com/apk/res/android">
         <!--  Non focused states 
          --> 
          <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/button_unfocused" /> 
          <item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/button_unfocused" /> 
         <!--  Focused states 
          --> 
          <item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/button_focus" /> 
          <item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/button_focus" /> 
         <!--  Pressed 
          --> 
          <item android:state_pressed="true" android:drawable="@drawable/button_press" /> 
        </selector>
    

    For each state, a drawable resource, e.g. button_press.xml:

    <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
      <stroke android:width="1dp" android:color="#FF404040" /> 
      <corners android:radius="6dp" /> 
      <gradient android:startColor="#FF6800" android:centerColor="#FF8000" android:endColor="#FF9700" android:angle="90" /> 
    </shape>
    

    Note the corners element, this gets you rounded corners!

    Then set the background drawable on the button:

    android:background="@drawable/button_background"
    

    EDIT (9/2018): The same technique can be used to create a circular button. A circle is really just a square button with radius size set to 1/2 the side of the square

    Additionally, in the example above the stroke and gradient aren’t necessary elements, they are just examples and ways that you’ll be able to see the rounded corner shape

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a flat button with rounded right top and bottom corners.
I want to create custom button with rounded bottom right and top right corners.
I want to create a rounded rectangular border for GridView on Android like the
I want to create an input fields with rounded corners. HTML: <div id=RightColumn> <input
I've fixed image size. And I want to achieve rounded corners through html/css. Options
I have created a view called RoundedImageView, the corners are rounded. I want an
I want to create a Toast message with custom background and custom rounded border.
I want to create a HTML button with rounded corner and elliptical shape without
I want to create a custom border with rounded corners. Code - import java.awt.BasicStroke;
I want to make a button style on Android with two background colors, such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.