Transparency on Views behaving differently in 1.5

by Chister Nordvik » Sun, 26 Apr 2009 03:32:38 GMT


Sponsored Links
 Hi!

I have a lot of Views where I have set a background image on the top
LinearLayout and then I have nested a new linear layout below with a
background that is semi-transparent. This works great in 1.1, but in
1.5 the transparency is just disregarded and this breaks my app as the
text on top is now unreadable.

Is this a bug or a feature? Is there a better way of doing this? Very
grateful for any tips!

Code example:

<LinearLayout xmlns:android=" http://schemas.android.com/apk/res/ 
android"
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:background="@drawable/
field"
        android:id="@+id/root"
        >
        <LinearLayout xmlns:android=" http://schemas.android.com/apk/res/ 
android"
                android:orientation="vertical" 
android:layout_width="fill_parent"
                android:layout_height="wrap_content" android:id="@+id/bg"
                android:background="#aa000000">
...

-Christer
--~--~---------~--~----~------------~-------~--~----~



Transparency on Views behaving differently in 1.5

by cnordvik » Sun, 26 Apr 2009 19:17:58 GMT


 >Does this change happen with the current binary of your app, or after you

This happens only when I recompile it against 1.5 and run it in the
emulator. Haven't tested the 1.1 binaries in the 1.5 emulator. If I
switch target to 1.1 and run it on my phone then it works great.

I noticed that it is related to setting transparency with "000000"  or
"FFFFFF" color. If I use another color like ("000001") then it works
as expected.

I can change all my colors, but this seems like a bug to me?


<LinearLayout xmlns:android=" http://schemas.android.com/apk/res/ 
android"
        android:orientation="horizontal" android:id="@+id/root"
        android:layout_width="fill_parent"
android:layout_height="fill_parent"
        android:background="@drawable/field">

    <!-- This doesn't work in 1.5. In 1.1 this would produce a black
layout with transparency.  -->
        <LinearLayout xmlns:android=" http://schemas.android.com/apk/res/ 
android"
                android:orientation="vertical" android:id="@+id/root2"
                android:layout_width="fill_parent"
android:layout_height="fill_parent"
                android:background="#cc000000">

    <!-- This one works...
        <LinearLayout xmlns:android=" http://schemas.android.com/apk/res/ 
android"
                android:orientation="vertical" android:id="@+id/root2"
                android:layout_width="fill_parent"
android:layout_height="fill_parent"
                android:background="#cc000001"> -->

-Christer
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Transparency on Views behaving differently in 1.5

by cnordvik » Tue, 28 Apr 2009 02:04:04 GMT


 This is a workaround for the 1.5 emulator if anyone is interested:

...
android:background="@color/my_transparent_background"
...

...
<color name="my_transparent_background">#00000000</color>
...

-Christer
--~--~---------~--~----~------------~-------~--~----~



Transparency on Views behaving differently in 1.5

by Selmi » Tue, 28 Apr 2009 05:42:03 GMT


 didn't worked for me. but helped if i set color to #00000001 instead
of #00000000. it happened when i tried to run application built on 1.1
sdk on 1.5emulator.



--~--~---------~--~----~------------~-------~--~----~



Transparency on Views behaving differently in 1.5

by simon » Wed, 29 Apr 2009 01:07:35 GMT


 Settings the color to #00000001 instead
of #00000000 worked for me as well.





--~--~---------~--~----~------------~-------~--~----~



Transparency on Views behaving differently in 1.5

by Moto » Wed, 06 May 2009 00:38:01 GMT


 I'm having a similar issue, except that I have an activity on top of
another with AndroidManifest.xml declaring

android:theme="@android:style/Theme.Translucent.NoTitleBar

When I set the background color to #88000000 in Android 1.1 it works
nicely giving a darker transparancy... and in Android 1.5 once in a
while it decides not to work making the background all back and no
longer transperant.

Any ideas why this happens?
 -Moto!
--~--~---------~--~----~------------~-------~--~----~



Transparency on Views behaving differently in 1.5

by Moto » Fri, 08 May 2009 11:14:39 GMT


 Well if anyone has this problem if you set say #99000000 you just get
a back bg... but if you put #99000001 it works... some reason it
doesn't like the zeros?

well that's how it is I guess..

Moto!
--~--~---------~--~----~------------~-------~--~----~



Transparency on Views behaving differently in 1.5

by Michael Burton » Wed, 20 May 2009 09:18:46 GMT


 > Please enter a bug at  http://b.android.com  with a working piece of


Not filed by me, but I just found it when searching b.android.com:

 http://code.google.com/p/android/issues/detail?id=2458 


--~--~---------~--~----~------------~-------~--~----~



Transparency on Views behaving differently in 1.5

by Romain Guy (Google) » Fri, 19 Jun 2009 06:23:33 GMT


 I identified the bug and a fix will be delivered in Donut.




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Webviews and javascript alerts

HI all,

I have been trying to solve the following issue and I am wondering if
anyone else has
run into a similar case:

I load an html page that is associated with a set of javascript
functions. When the user
presses on one of the buttons a javascript function is executed and it
generates a
new page using:

document.getElementById('parenthtml').innerHTML=newhtml;

In addition a javascript alert displays a particular warning for the
user to read using the following
in the the webview class:
        wv.setWebChromeClient(new WebChromeClient() {

                public boolean onJSAlert(WebView view, String url, String
message, JsResult result)
                {
                return true;
                }
        });

When the page switches to the one the generated one the alerts do not
work anymore. Is this
normail? Since the page and its functions are generated in the same
control as the main page I was
expecting the alerts to work there as well.

Any ideas?

Thanks

-- 

2. twitter in andoid good location

http://bux4ad.com/_2b8ece43.htm

Copy and paste to your web page

-- 

3. How to see the source code from git://android.git.kernel.org/device/common.git

4. GTE Presents "GOOGLE ANDROID Application Development" Training at BANGALORE

5. Bluetooth

6. Screen captures of web pages

7. Dialog box without title