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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:40:05+00:00 2026-06-17T20:40:05+00:00

I wanted to add a linear layout, having a transparent background as well as

  • 0

I wanted to add a linear layout, having a transparent background as well as with white borders. The problem is: as far as I have googled, I can achieve only one out of both.

Here’s what I did:

  1. Saved the following as border.xml in drawable

      <?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="#FFFFFF" /> 
      </shape>
      </item>   
         <item android:left="5dp" android:right="5dp" android:top="5dp" android:bottom="5dp" >  
         <shape android:shape="rectangle"> 
         </shape>
       </item>    
      </layer-list> 
    
  2. my existing page layout

         <LinearLayout
            android:id="@+id/quiz"
            android:layout_width="150dp"
            android:layout_height="120dp"
            android:background="#66041414"          <-------- replaced it with android:background="@drawable/border"
            android:orientation="vertical"
            android:layout_marginLeft="5dp" >
    
             ......
           </LinearLayout>
    

I am getting opaque background, when the border was included.

I wanted a final result to be like:

Reference image

totally stuck with it. Just wanted to find a way out to achieve it. Any suggestions would be quite helpful.

  • 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-17T20:40:06+00:00Added an answer on June 17, 2026 at 8:40 pm

    Your drawable for background of layout:

    You can change radius for corner shape if you want. But stroke will create a border and solid part is the background which we are making transparent.

    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
           android:shape="rectangle">
      <corners
          android:radius="2dp"
          android:topRightRadius="0dp"
          android:bottomRightRadius="0dp"
          android:bottomLeftRadius="0dp" />
      <stroke
          android:width="1dp"
          android:color="@android:color/white" />
      <solid android:color="@android:color/transparent"/>
    </shape>
    

    and my test layout.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/ll1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
    
    
        <LinearLayout 
            android:id="@+id/ll2"
            android:layout_height="50dp"
            android:layout_width="50dp"
            android:background="@drawable/my_transparent_linear_layout"></LinearLayout>
    </LinearLayout>
    

    It works, Below is the proof:

    enter image description here

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

Sidebar

Related Questions

Lets say i wanted to add another variable to the database can anybody tell
I have a UIImageView and I wanted to add a black overlay on top
I have a photologue site set up and I really wanted to add an
I wanted to add some Overlay items to MapsForge at runtime; I can successfully
I wanted to add a PDF generation button for articles. Everything is working well
If i wanted to add an attribute to the root element record, can i
I wanted to add one scrollbar into the RoundedRectangle. I have 3 Rounded rectangle
I wanted to add a voice chat feature to my business app. I have
I wanted to add more methods to the Calendar from java.util.Calendar, but I'm having
I wanted to add crash reporting capabilities to my iPhone app. Kind of 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.