set shape background to transparent in android

Cote Mounyo picture Cote Mounyo · Jul 4, 2013 · Viewed 32.7k times · Source

I have a shape drawable that I want to use as a background. I want the shape to be transparent. But so far it's not. How do I do that? Here is what I have:

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:padding="10dp"
    android:shape="rectangle" >

    <solid android:color="#80000000" />

    <stroke
        android:width="1dip"
        android:color="#000000" />

    <corners android:radius="10dp" />

</shape>

I expected the line <solid android:color="#80000000" /> to do the trick.

EDIT:

In manifest, I set android:theme="@android:style/Theme.Dialog". Could that be the cause of the problem? I am basically trying to get this view on top of another. Changing to 00 or FF or whatever else does not work.

Answer

Volodymyr Yatsykiv picture Volodymyr Yatsykiv · Jul 4, 2013

if you want set shape background to transparent you need to set this color

<solid android:color="#00000000" />