1

I have following code for main layout:

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

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:background="#FFFFFF" />

</LinearLayout>

I need that the LinearLayout will be transparent. I thought that I can do it using the alpha setting in a background attibute, but it doesn't work. Please, tell me - I need that my application will be empty and has a white rectangle on the center of a screen.

user1166635
  • 2,741
  • 6
  • 22
  • 32

2 Answers2

1

You want the activity to be transparent? Try using this theme in your activity tag (in the manifest file): @android:style/Theme.Translucent

For other possible ways, ie child theme see the following answers:

Activity should be transparent, but has black background

How do I create a transparent Activity on Android?

how to make activities transparent

Community
  • 1
  • 1
David Olsson
  • 8,085
  • 3
  • 30
  • 38
0

Use below line in the xml file:

<Linearlayout android:background="@android:color/transparent"/>
Hitesh Patel
  • 2,868
  • 2
  • 33
  • 62
Pradeep Sodhi
  • 2,135
  • 1
  • 19
  • 19