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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:25:34+00:00 2026-06-12T11:25:34+00:00

I have a single activity with a simple layout (a bunch of coloured panels)

  • 0

I have a single activity with a simple layout (a bunch of coloured panels) and I’m trying to overlay a small moving graphic on a transparent view over the top. Like @umar here I’m following this tutorial but my overlay view is refusing to be transparent. I can make the view appear, it contains just what it should, but the background of the view is black and however I try to make it transparent fails. I’ve tried a few of the solutions mentioned on SO and it always comes out the same.

My layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/everything"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#00ffffff"
>

<LinearLayout
    android:id="@+id/row_1_bg"
    android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:orientation="horizontal"
    >

    <FrameLayout
        android:layout_height="fill_parent"
        android:layout_width="100dp"
        >

        <LinearLayout
            android:id="@+id/row_1_table"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            android:background="#808080"
            >

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="0dip"
                android:layout_weight="1"
                android:orientation="horizontal"
                >

            <TextView  
                android:id="@+id/row_1_pantone"
                android:paddingLeft="6dip"
                android:textColor="#f0f0f0"
                android:textStyle="bold"
                android:gravity="center_vertical"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                >
            </TextView>
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="0dip"
            android:layout_weight="1"
            android:orientation="horizontal"
            >
            <TextView  
                android:id="@+id/row_1_rgb"
                android:paddingLeft="6dip"
                android:textColor="#f0f0f0"
                android:textStyle="bold"
                android:gravity="center_vertical"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                >
            </TextView>
        </LinearLayout>
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="0dip"
            android:layout_weight="1"
            android:orientation="horizontal"
            >
            <TextView  
                android:id="@+id/row_1_hex"
                android:paddingLeft="6dip"
                android:textColor="#f0f0f0"
                android:textStyle="bold"
                android:gravity="center_vertical"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                >
            </TextView>
        </LinearLayout>
    </LinearLayout>
</FrameLayout>
</LinearLayout>

<LinearLayout 
android:layout_height="fill_parent" 
android:layout_width="fill_parent" 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:paddingRight="5px" 
android:paddingTop="5px" 
android:paddingLeft="5px" 
android:gravity="bottom" 
android:orientation="vertical"
android:background="#00808080"> 

<barry.pantone.TransparentPanel 
        android:layout_height="wrap_content" 
        android:layout_width="fill_parent" 
        android:id="@+id/transparent_panel" 
        android:paddingRight="5px" 
        android:paddingTop="5px" 
        android:paddingLeft="5px" 
        android:paddingBottom="5px"
        android:background="#00808080"> 

        <Button 
            android:layout_height="wrap_content" 
            android:layout_width="wrap_content" 
            android:id="@+id/button_click_me" 
            android:text="Click Me!"
            /> 
</barry.pantone.TransparentPanel> 
</LinearLayout>

</LinearLayout>

My TransparentPanel.java is straight from the tutorial, using:

innerPaint.setARGB(225, 75, 75, 75);

to make a transparent panel, and this is my onCreate from the main activity:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Resources res = getResources();
    sPantone = res.getStringArray(R.array.pantone); // gets colour definitions

    iHeight = getWindowManager().getDefaultDisplay().getHeight();

    PopulateTable (); // draws colours in the various layout elements
    }

The problem is that whatever I do inside the view is fine – I can draw a semi transparent panel over other elements in that view, but the overlay view itself has a black background which obscures the layout beneath. If anyone can help me understand why transparency doesn’t work, I will be eternally grateful.

Many thanks

Baz

EDIT

Following another idea I tried moving the definition of the overlay out into its own XML file and using a LayoutInflater to inflate and add the new view. Nope. Exactly the same – the additional view has a solid background. Here’s the tranny.xml layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
android:background="#80000040"
android:layout_height="fill_parent" 
android:layout_width="fill_parent" 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:paddingRight="5dip" 
android:paddingTop="5dip" 
android:paddingLeft="5dip" 
android:gravity="bottom" 
android:orientation="vertical"
> 
<Button 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:id="@+id/button_click_me" 
    android:text="Click Me!"
    /> 
</LinearLayout>

and here’s the code from onCreate to inflate the new view and add it to the main layout:

private View view;
ViewGroup parent = (ViewGroup) findViewById(R.id.everything);
view = LayoutInflater.from(getBaseContext()).inflate(R.layout.tranny, parent, false);
parent.addView(view);

Basically I’ve gone about creating exactly the same result using a different technique. Handy to learn about LayoutInflater for the first time, but no help re transparency 🙁

  • 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-12T11:25:35+00:00Added an answer on June 12, 2026 at 11:25 am

    OK, no answers so I’m assuming there’s no way to use parent.addView(view) to add an overlaid view which has a transparent background. I had hoped to add a narrow transparent view over the right hand edge of my layout (a scrollbar) into which I could draw a bitmap indicating the position in the big list of displayed items.

    Instead I have now made my whole layout slightly narrower and left room for a narrow LinearLayout down the right edge, which has a black background, and into that I draw my bitmap, so I get this:

    enter image description here

    I would have preferred to put the pointer over the top of the blocks of colour, but unless some guru in the future finds this question and shows us how to do it, I’m close enough.

    Baz.

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

Sidebar

Related Questions

In my project, i have a simple activity composed of a single XML layout
I have an single Activity application that starts a Service and binds to it.
I have read nearly every single post about the activity not found to handle
I have a single-view application that takes in a username and a password and
I have a single view application. It has myAppDelegate and myViewController. In a earlier
I have a headset with single button and want to do a simple Toast
In an MVC style Ext JS 4 application, assuming I have a single controller/view/store/model
My android app is simple : a single activity contains a webview which shows
I'm trying to create a simple Android application using min3d library Previously I have
i have a single filed which i need to clone with a clone button

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.