Android dynamic background -


I'm a new Android developer and there is a question about changing the background dynamically on runtime.

What I want to do is set a background color in a LinearLayout tag, and later my activity changes the background color in the class. This code is not working below. Am I missing something or is it a wrong approach to trying to change the background color in a linear layout

  LinearLayout lv = (LinearLayout) findViewById (R.id.ChoiceLayout); Lv.setBackgroundColor (0x000080);  

Thanks in advance

First of all I have noticed that your colors In alpha = 0x00 . Makes it transparent. Try changing to

  lv.setBackgroundColor (0xFF000080);  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -