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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:42:27+00:00 2026-06-06T12:42:27+00:00

I am trying to make a frame from code so that I can apply

  • 0

I am trying to make a frame from code so that I can apply it to make rounded inner corners with a solid fill outside and transparent inside. Just like a solid rectangle with transparent oval inside. picture attached. I have tried few shape combinations all that available online displays the corners outside.

enter image description here

The inside should be transparent not white.
The image is taken from this post but the solution presented here is not what I am looking for I dont want to use a 9 patch drawable but would like to be created in code.

Please valid answers only.

  • 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-06-06T12:42:28+00:00Added an answer on June 6, 2026 at 12:42 pm

    First of all, create 3 xml layout in drawable folder:

    1. First: frame.xml
    2. Second: frame_build.xml
    3. Third: red.xml

    (You can change this name as you wish),

    frame.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:bottom="20dp" android:drawable="@drawable/red" android:top="-25dp" />
        <item android:bottom="15dp" android:drawable="@drawable/frame_build" android:top="5dp" android:left="-5dp" android:right="-5dp" />
    </layer-list>
    

    frame_build.xml :

    <?xml version="1.0" encoding="UTF-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
        <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" />
        <corners android:radius="40dp" />
    </shape>
    

    red.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
        <stroke android:width="40dp" android:height="40dp" android:color="#B22222" />
        <padding android:left="8dp" android:top="-1dp" android:right="8dp" android:bottom="9dp" />
        <corners android:radius="-10dp" />
    </shape>
    

    Finally refer your view or layout to Frame XML as follow :

      android:background="@drawable/frame"
    

    This tested and output as below image:

    Output image

    Hope this help .

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

Sidebar

Related Questions

I'm trying to make a decision tree using rpart using a data frame that
Trying to make a custom :confirm message for a rails form that returns data
Trying to make a toggle button that hides/shows the right window/pane. Here is a
I'm trying to programmatically close a Facebox modal with JavaScript code that's called within
So I have this code, which I am trying to use to make it
I'm trying to make some components inside a JSrollPane unresizable, because content inside can
I'm trying to make an image mosaic that consists mostly of images of the
i'm trying to use compiled assets and code from a swc. Inside a new
I'm trying to get a specific cell from a table view so I can
This is a function taken from Pro JavaScript techniques that I'm trying to understand,

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.