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

  • SEARCH
  • Home
  • 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 4324624
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:09:28+00:00 2026-05-21T09:09:28+00:00

I am working on android frameworks. I need to modify the shape of the

  • 0

I am working on android frameworks. I need to modify the shape of the textview such that it should have rounded corners. Can you please help me with this issue?

  • 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-21T09:09:29+00:00Added an answer on May 21, 2026 at 9:09 am

    XML file saved at res/drawable/gradient_box.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
        <gradient
            android:startColor="#FFFF0000"
            android:endColor="#80FF00FF"
            android:angle="45"/>
        <padding android:left="7dp"
            android:top="7dp"
            android:right="7dp"
            android:bottom="7dp" />
        <corners android:radius="8dp" />
    </shape>
    

    This layout XML applies the shape drawable to a View:

    <TextView
        android:background="@drawable/gradient_box"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content" />
    

    This application code gets the shape drawable and applies it to a View:
    Resources res = getResources();
    Drawable shape = res. getDrawable(R.drawable.gradient_box);

    TextView tv = (TextView)findViewByID(R.id.textview);
    tv.setBackground(shape);
    

    Copy&Paste from http://developer.android.com/guide/topics/resources/drawable-resource.html, first result when you google “android textView rounded corners”

    [EDIT]

    As you want to change the source of the android framework, you can alter the style of the TextView by altering the default Drawables. In the sources the various Drawables are grouped in an inner class called Drawables:

    class Drawables {
            final Rect mCompoundRect = new Rect();
            Drawable mDrawableTop, mDrawableBottom, mDrawableLeft, mDrawableRight;
            int mDrawableSizeTop, mDrawableSizeBottom, mDrawableSizeLeft, mDrawableSizeRight;
            int mDrawableWidthTop, mDrawableWidthBottom, mDrawableHeightLeft, mDrawableHeightRight;
            int mDrawablePadding;
        }
    

    Just alter these Drawables as you like and you have redefined TextView.

    I’m referring to that version of the TextView sources.

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

Sidebar

Related Questions

I have a working android app using TextView, some formatting (line breaks, rows of
I am working on Android Application. Now I have requirement of search the entered
I am currently working on android project where I want to have a text
I'm working with Android and I really need a fast way to get a
I am working on Android 2.1 with API v7 . How can I implement
I'm working on Android, but this is a java question. I have an image
I am working android application that required login, Now I want After successfully login
I already have a working android app with several persisted objects/classes. But what if
I'm working on an app that involves and ExpandableListView. We should like to replace
I am working an XMPP client for both Android and iPhone. I have been

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.