java - Android: changing colors gradually for multiple imageview backgrounds using seekbar -
i using background color on imageview create rectangle color , want to morph gradually lighter color using seekbar removing r g or b hex color. how can without writing 1000000 lines of code? illustration of want do, experimenting 1 box though. https://d396qusza40orc.cloudfront.net/cmsc436/labs/modernartui/modernui.mp4
seekbar.setonseekbarchangelistener(new seekbar.onseekbarchangelistener() { @override public void onprogresschanged(seekbar seekbar, int i, boolean b) { if (i >= 25 && < 50) { imageview.setbackgroundcolor(color.blue); } else if (i >= 50 && < 75) { imageview.setbackgroundcolor(color.green); } else if (i >= 75 && <= 100) { imageview.setbackgroundcolor(color.yellow); } else { imageview.setbackgroundcolor(color.white); } }
answer found:
seekbar.setonseekbarchangelistener(new seekbar.onseekbarchangelistener() { @override public void onprogresschanged(seekbar seekbar, int i, boolean b) { iv1.setbackgroundcolor(color.argb(0xff, i, i, 200)); }
depending on color want, set max on seekbar 255 , can play around numbers desired color @ gradual change. great reference when trying find color http://www.tayloredmktg.com/rgb/
seekbar.setonseekbarchangelistener(new seekbar.onseekbarchangelistener() { @override public void onprogresschanged(seekbar seekbar, int i, boolean b) { iv1.setbackgroundcolor(color.argb(0xff, i, i, 200)); }
depending on color want, set max on seekbar 255 , can play around numbers desired color @ gradual change. great reference when trying find color http://www.tayloredmktg.com/rgb/
java android
No comments:
Post a Comment