Is there a way to force an android view to redraw it's background? I have set a drawable shape with a gradient as background which works fine but after changing the view's height you can see those ugly gradient steps.
What can I do?
I tried view.invalidate()
and view.refreshDrawableState()
without any visible difference.
Thank you!
//EDIT: Here are some more details and my code: After your answers I think the banding is a result of my probably bad code. Here is what I'm doing:
Here is my code:
public void onAnimationEnd(Animation animation)
{
MyView view = (MyView) ((ExtendedScaleAnimation) animation).getView();
view.getLayoutParams().width = toWidth;
view.getLayoutParams().height = toHeight;
view.clearAnimation();
view.requestLayout();
view.refreshBackground(); // background will be changed
}
On the device you can see that the background drawable is changed but there is a flickering which seems to me like the backround change is applied before the animation is over. Programatically it should be over! Or am I wrong?
Thank you again!
Can you try after resize: v.setBackgroundResource(null); v.setBackgroundResource(...my drawable...);