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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:35:00+00:00 2026-06-10T07:35:00+00:00

How can I create a gradient border like in the image below?

  • 0

How can I create a gradient border like in the image below?

border

  • 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-10T07:35:02+00:00Added an answer on June 10, 2026 at 7:35 am

    You can achieve this by using a layerlist and messing with the padding. You’ll need 3 elements:

    1: A border.xml shape, which is just a solid shape in the color of your border: border.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android">
        <solid android:color="#ff0000"/>
    </shape>
    

    2: The ‘inner’ shape, the shape where you want the border to appear around: inner.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android">
        <solid android:color="#00ff00"/>
    </shape>
    

    3: A layer list, which will put these 2 on top of eachother. You create the border by setting the padding on the inner shape: layerlist.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/border"/>
    <item android:drawable="@drawable/inner"
    

    Specify here where you want to have a stroke(top, left, right, bottom)

    android:top="3dp" android:right="0dp" android:bottom="3dp"
    android:left="3dp" />
    

    Set this as the background of your TextView, Layout etc. (where you want the stroke to appear)

    Or just create a 9Patch image with the borders.

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

Sidebar

Related Questions

How can I create a gradient image (with a given height & width, start
I use border image to create a gradient on the left border of a
How can I create this gradient and shadow box from the attached image? Thanks
How can I create a border (gradient from #color1 to transparent) around the activity
I can create database manually by going to cpanel. But I'd like to create
I would like to create a UIBezierPath with 10px rounded corners and with gradient
Can't create array of coreGraphic gradient colors list I have an if statement for
How can I create a button style like that of the Sign in button
How can I create a gradient background for my form and text without using
How can I create some gradient color in matplotlib and then set the parameter

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.