-1

I am creating an app, where i am creating a layout like this image,

glassy Look

but i want that the upper part of the image should be of some other color, but the color should be transparent, so that the background should be visible from that color. I am using a style xml for this,

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
     android:shape="rectangle"> 
     <stroke android:width="2dp" android:color="#FFFFFFFF" />
     <gradient android:startColor="#DD000000" android:endColor="#DD2ECCFA" 
            android:angle="225"/> 

    <corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" 
     android:topLeftRadius="7dp" android:topRightRadius="7dp"/> 
</shape> 

But it is creating a color layout that is not transparent and the background is not visible from this color. suggest some tips to make the color transparent, so that i can attain a glassy look for layout.

Sahil Mahajan Mj
  • 11,033
  • 8
  • 53
  • 100
  • possible duplicate of http://stackoverflow.com/questions/11559832/how-to-make-buttons-color-like-glasss-color-in-android-eclipse/11560893#11560893 – Ram kiran Pachigolla Aug 30 '12 at 05:47
  • What is the `upper part of the image`? – iTurki Aug 30 '12 at 05:50
  • i have a scroll view, which is the upper part whose background is linear layout whose background is blue. i want to make the scroll's background color opaque, so that the linear layout's color is visible from it. – Sahil Mahajan Mj Aug 30 '12 at 05:57
  • You mean that this style is applied to the ScrollView? – iTurki Aug 30 '12 at 06:05
  • yes exactly, this style is applied to scrollview to make its color opaque. i added a line.. .. to make it opaque, as AA is for making things opaque, but its not working as such.. – Sahil Mahajan Mj Aug 30 '12 at 06:08
  • possible answer http://stackoverflow.com/a/26270218/185022 – AZ_ Oct 09 '14 at 04:15

2 Answers2

5

use this code,

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
 android:shape="rectangle"> 
 <stroke android:width="2dp" android:color="#FFFFFFFF" />
 <gradient android:startColor="#DD000000" android:endColor="#DD2ECCFA" 
        android:angle="225"/> 

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

<corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" 
 android:topLeftRadius="7dp" android:topRightRadius="7dp"/> 
</shape> 

Add one line your code ,

<solid android:color="#AA181818" />
rajeshwaran
  • 1,512
  • 1
  • 18
  • 24
2

The isuue is solved, thanx rajeshwaran, i have used..

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
     android:shape="rectangle"> 
     <stroke android:width="1dp" android:color="#FFFFFFFF" />

<solid android:color="#150000A0" />
    <corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" 
     android:topLeftRadius="7dp" android:topRightRadius="7dp"/> 
</shape> 

I have just given values instead of AA in solid tag..

<solid android:color="#150000A0" />

Thanx for help.. helped me in understanding the concept of color..

 <solid android:color="#AARRGGBB" />
Sahil Mahajan Mj
  • 11,033
  • 8
  • 53
  • 100