Reputation: 65
Am working on a basic flashlight app and would like for the colors of the screen to change as i scroll thru the screen. I have been looking for some examples on how to do this but have had no luck. was hoping someone could point me in the right direction. So far i know i have to use OnScrollListener()
Thank you
Upvotes: 0
Views: 156
Reputation: 11439
This was taken from MindTheRobot
Paint paint = new Paint();
int color = 0x00000000;
float position = getRelativeTemperaturePosition();
if (position < 0) {
color |= (int) ((0xf0) * -position); // blue
} else {
color |= ((int) ((0xf0) * position)) << 16; // red
}
//Log.d(TAG, "*** " + Integer.toHexString(color));
LightingColorFilter logoFilter = new LightingColorFilter(0xff338822, color);
paint.setColorFilter(logoFilter);
Upvotes: 1