android - Changing Layout Background Colors in Java -


i made app several xml layouts (and gave them colorful backgrounds too!) however, friend noted little 'too' colorful.

so, decided add checkbox main.xml file, checked default. if unchecked, want every background color go black, buttons' colors change background color "@drawable/buttoncolor" "@drawable/colorless", , text in buttons change white ("#ffffff"). if checked again, program should restore default.

so question is... how this? established this:

view colorbox = findviewbyid(r.id.nocolor); colorbox.setonclicklistener(this); 

where colorbox checkbox.

and later on...

public void onclick(view v) {     switch (v.getid()) {     // (other code have here)     case r.id.nocolor:         // go here..?         break;     } } 

all appreciated.

(on side note, solution didn't work me either: how change textview's background color color defined in values/colors.xml file?)

colorbox.setbackgroundresource(r.drawable.colorless); ((textview)colorbox).settextcolor(color.white); 

you need import java.awt.color


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -