Is there any way to get android view to redraw its background? I set a flexible shape with a gradient as the background, which works great, but after changing the height of the view, you can see these ugly gradient steps.
What can I do? I tried view.invalidate()and view.refreshDrawableState()without visible differences.
Thank!
// EDIT: Here are a few more details and my code:
After your answers, I think the bandages are the result of my probably bad code. That's 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();
}
On the device, you can see that the background image can be changed, but there is a flicker that seems to me like changing the background before the animation ends. Programmatically, it must be finished! Or am I wrong?
Thanks again!
source
share