Background Drawable with different Layers

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Background Drawable with different Layers

Postby VIDEN » Fri Jun 19, 2009 3:35 pm

Hey,


so... I'm still working on my building automation program and I came up with a new idea / problem.

Well as you can see on the picture below the program is supposed to enable people to switch lights on and off.
As this happens the Background image should change so you can physically see if a light is turned on or off.

Well as long as there just is one light in the room this is no problem. I just render 2 pictures and change the pictures when the light is on/off.

But when it comes to more than 3 lights that can separately be turned on and off I start to run in Problems because I get tons of light on/off combinations...

What I was thinking of is just having one Background img and then layering half transparent lights over the picture. This way I would just have 1 background img and 1 img for every light that is layered over the bg img depending on its state...

My problem is, that I don't know how to solve this problem and if the android Drawables can handle the functionality that I whish

any ideas?

Greets David
Attachments
Android_Demo_LightOnOff.jpg
Android_Demo_LightOnOff.jpg (75.37 KiB) Viewed 158 times
VIDEN
Developer
Developer
 
Posts: 32
Joined: Tue May 12, 2009 9:39 am
Location: Germany

Top

Postby WarrenFaith » Fri Jun 19, 2009 7:36 pm

I recommend you a SurfaceView.... nothing easier than that.
If you wish today the light effect.... just image what you want tomorrow :)

As long as you stay in 2D you shouldn't have anything to worry about if you using a SurfaceView for your room.

Tutorial for 2D: Playing with graphics in Android - Part I
WarrenFaith
Moderator
Moderator
 
Posts: 227
Joined: Fri Mar 13, 2009 10:59 am
Location: Berlin, Germany

Postby VIDEN » Mon Jun 22, 2009 12:39 pm

Hey,

Thanks so much! I'll have a look at it right away

Greets

David
VIDEN
Developer
Developer
 
Posts: 32
Joined: Tue May 12, 2009 9:39 am
Location: Germany

Postby VIDEN » Mon Jun 22, 2009 1:47 pm

Hey,

well I took a look at your SurfaceView tutorial which is really good, I might use some of the things you showed there.
But I also found the LayerDrawable class which might be better suited for my matter, because I can just use it as BackgroundDrawable for my custom Absolute Layout.

I still have to find out if it is possible to draw just specific layers of the LayerDrawable.


Greets David
VIDEN
Developer
Developer
 
Posts: 32
Joined: Tue May 12, 2009 9:39 am
Location: Germany

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests