I would like to do the following:
LinearLayout
with several ImageViews
with background colors defined in their xml.SeekBar
.Seekbar
I should change the colors of the Imageviews
background.I would like to save the default background colors but can`t find getbackgroundcolor method, only setbackground method.
Later I would like to change the colors as the Seekbar
is progressing.
I have something like this now:
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
// TODO Auto-generated method stub
int test = seekBar.getProgress();
//textView.setText("Valami" + test);
switch (test) {
case 0:
imageView0.setBackgroundColor(Color.RED);
imageView1.setBackground(Color.YELLOW);
break;
case 1:
imageView0.setBackgroundColor(Color.BLACK);
imageView1.setBackgroundColor(Color.BLACK);
break;
case 2:
imageView0.setBackgroundColor(Color.WHITE);
imageView1.setBackgroundColor(Color.YELLOW);
break;
}
I think this is not the right way, and I would like to change their color by getting the actual SeekBar
progress value. For example add some value to the original color code based on the progress value.
This is my idea, but I don`t know how to implement it.
Thanks for your help!
The suggestion from stkent has helped me.
Actually the answer in this post: android color between two colors, based on percentage? has helped me a lot.
In this case Mark Renouf`s solution was very helpful.
Thanks!