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 7652751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:51:05+00:00 2026-05-31T11:51:05+00:00

I use shapes to give my views (buttons) a rounded corner and a gradient.

  • 0

I use shapes to give my views (buttons) a rounded corner and a gradient. To switch between pressed, enabled and disabled I use a selector. Every item in the selector is a shape with an other gradient. Now I want to have all my shapes to have some default styles like all should have the same corner radius.

Selector:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_button_disabled"
      android:state_enabled="false" />
<item android:drawable="@drawable/shape_button_pressed"
      android:state_pressed="true" />
<item android:drawable="@drawable/shape_button_enabled" /></selector>

Shapes:

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <gradient android:startColor="@color/yellow_50"
        android:endColor="@color/yellow_25"
        android:angle="90"/>
    <corners android:radius="5px"/>

How can I define the corner radius at only one spot?

  • 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-31T11:51:07+00:00Added an answer on May 31, 2026 at 11:51 am

    Define your 5px as a dimension resource (dimens.xml)
    http://developer.android.com/guide/topics/resources/more-resources.html#Dimension

    Then you can access it from all your drawable shape files.

    <dimen name="radius">5px</dimen>
    

    And access it as:

    "@dimen/radius"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why I can't use a class that inherits a Shapes class ? I need
content called by AJAX content requires different shapes and sizes of cluetips (I use
I currently use the rectangle shape xml tag to specify borders for my views
I'm making an application that draws shapes and I use a camera to draw
We use System.Windows.Shapes.Path to visually connect elements in our application. Is it possible to
I want to give my Widget a gradient background. For this, I used following
I am trying to use css shapes instead of images wherever it seems appropriate.
I have a little drawing app and want to use complex shapes as brushes,
I'm trying to give shapes in my physics engine roundness/ curvature. I am aware
I've figured out how to use the NSBezierPath class to draw shapes in the

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.