I using my custom Preference extended class for PreferenceActivity. I want the icon to by transparent when preference is disabled. On all my custom preferences it works with this code:
@Override
public View onCreateView(ViewGroup parent)
{
try {
getIcon().setAlpha(isEnabled() ? 255 : 62); // Adjust alpha as needed
} catch (Exception e) {
}
return super.onCreateView(parent);
}
@Override
public void setEnabled(boolean enabled)
{
super.setEnabled(enabled);
try {
getIcon().setAlpha(isEnabled() ? 255 : 62); // Adjust alpha as needed
} catch (Exception e) {
}
}
But I have one preference when the icon become 100% visible every time when I change any other preferences. You can see here how it behaves: https://www.youtube.com/watch?v=defFhHxHteQ
I tried add that code above everywhere in that preference class. Into constructor before super() calls and after. Into onCreateView, setEnabled, onBindView and more. But it always behave laik in the video. What I missing? How to do it right?