Re: [android-beginners] how to change colours in a .xml defined layout in run time

2010-06-23 Thread TreKing
On Wed, Jun 16, 2010 at 6:55 AM, ckloch htc.kl...@hotmail.com wrote:

 In theory it seems to be easy, but I would highly appreciate your help on
 how to do this in Android as I cannot see how I start changing the colours
 of the individual bar in the screen after initially defining the screen.


Whatever View you're using to represent the bars should have some background
property for changing it's background image or color. Try that.

-
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] how to change colours in a .xml defined layout in run time

2010-06-16 Thread ckloch
Dear friends,

I am developing a small app that should inform the drivers whether his
current speed matches the preferred one in order to avoid stopping for
the red light.

I have no probelms to calculate the relative speed of the vehicle and
compare it with the preferred speed in order to determine and inform
the driver whether his speed is appropriate for crossing the traffic
light when it is green, or he needs to slow down or speed up.

But, I would be very thankful if you can help me to display this
graphically.

My current idea is to draw a traffic light (in red and green) on the
screen in .xml, using 11 equally sized bars. Hereby, I can show
whether the speed fits perfectly (then bar 6 should be black), or
there is no room for delay (then bar 4 should be black)
So far, I have made the traffic light in .xml.

My next step is to change the color of one of the bars dependent on
how the relative speed matches the shifts in the traffic light.
In theory it seems to be easy, but I would highly appreciate your help
on how to do this in Android as I cannot see how I start changing the
colours of the individual bar in the screen after initially defining
the screen.

There might be other and better ways to implement this than .xml

I would appreciate your help;

Best regards
ckloch

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en