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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:37:29+00:00 2026-06-03T04:37:29+00:00

How to add border around linear layout except at the bottom ? LinearLayout needs

  • 0

How to add border around linear layout except at the bottom ?
LinearLayout needs to have border at left, top and right side but not at the bottom.

  • 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-03T04:37:30+00:00Added an answer on June 3, 2026 at 4:37 am

    Create an XML file named border.xml in the drawable folder and put the following code in it.

     <?xml version="1.0" encoding="utf-8"?>
     <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
      <item> 
        <shape android:shape="rectangle">
          <solid android:color="#FF0000" /> 
        </shape>
      </item>   
        <item android:left="5dp" android:right="5dp"  android:top="5dp" >  
         <shape android:shape="rectangle"> 
          <solid android:color="#000000" />
        </shape>
       </item>    
     </layer-list> 
    

    Then add a background to your linear layout like this:

             android:background="@drawable/border"
    

    EDIT :

    This XML was tested with a galaxy s running GingerBread 2.3.3 and ran perfectly as shown in image below:

    enter image description here

    ALSO

    tested with galaxy s 3 running JellyBean 4.1.2 and ran perfectly as shown in image below :

    enter image description here

    Finally its works perfectly with all APIs

    EDIT 2 :

    It can also be done using a stroke to keep the background as transparent while still keeping a border except at the bottom with the following code.

    <?xml version="1.0" encoding="utf-8"?>
     <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
       <item android:left="0dp" android:right="0dp"  android:top="0dp"  
            android:bottom="-10dp"> 
        <shape android:shape="rectangle">
         <stroke android:width="10dp" android:color="#B22222" />
        </shape>
       </item>  
     </layer-list> 
    

    hope this help .

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

Sidebar

Related Questions

I want to add a border radius around the entire table. But the following
I added a full border around a view but I need to add just
I am trying to add a curved border around an image downloaded and to
I have an image 100x40 and I want to add a border to the
I'm trying to add a bottom border to a title thats wrapped within a
I want to have a border around ListViewItem (row in my case). ListView source
I'm trying to add 3 panels to the border layout only North South and
Using jquery how can one add a black border around all p elements that
Is there any simple way to add a image border around an image? Reason
I want to disable the border around iPhone SDK's add button, so it's just

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.