Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override theme color for touch highlight, scroll hinting

I am trying to substitute and override the default touch highlight color of the theme for the corporate ones.

I have successfully done it for the actionbar buttons by using actionBarItemBackground on my theme properties, but I am looking at an application-wide change where every pressed element in buttons, actionbar, drawer or menus defaults to my color instead of the Holo blue. I have tried properties like colorPressedHighlight. colorFocusedHighlight but none worked.

I would also like to change the color of the scroll end hinting, the little gradients on the sides of a scrollable element when it has reached one end and the uses is still attempting to scroll.

Given the high volume of incorrect answers, let me restate again. I know what a selector is, I know how to use it, I have explicitly stated that I have overriden the theme with several different subproperties but none does what I asked for. I am looking for the property to change both the default touch highlight for all elements, and the color for the scroll cache hinting, again for all elements.

like image 486
MLProgrammer-CiM Avatar asked Jan 10 '14 12:01

MLProgrammer-CiM


2 Answers

To change the end-of-scroll hint you can try this library for a fancy solution, or just the code below for a quick solution(code source and explanation):

static void brandGlowEffect(Context context, int brandColor) {
    int glowDrawableId = context.getResources().getIdentifier("overscroll_glow", "drawable", "android");
    Drawable androidGlow = context.getResources().getDrawable(glowDrawableId);
    androidGlow.setColorFilter(brandColor, PorterDuff.Mode.MULTIPLY);
}

Note that both of these are a bit hacky fundamentally as they works on platform drawable resources that are not guaranteed to stay the same between Android releases, though the plus note is that these resources have not been renamed from 1.0 to KitKat.

like image 114
Kai Avatar answered Oct 15 '22 06:10

Kai


I found the answer here: https://stackoverflow.com/a/9062723/1266326

The name of the component is not scroll hinting but overscroll.

like image 26
MLProgrammer-CiM Avatar answered Oct 15 '22 07:10

MLProgrammer-CiM