I am trying to achieve an effect for my Android TV app so that views expand while they're focused.
I did that by animating the ViewHolder's main view's LayoutParams
.
It works fine but the problem is that when i scroll towards the end of the view (Horizontal LinearLayout) the view expansion is not aligned with the end of the view, so it causes a really weird effect.
Theres my code:
holder.m_view.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean b) {
if (b)
{
ResizeAnimation anim = new ResizeAnimation(view, 600, view.getWidth());
anim.setDuration(200);
anim.setInterpolator(new AccelerateDecelerateInterpolator());
view.startAnimation(anim);
}
else
{
ResizeAnimation anim = new ResizeAnimation(view, 400, view.getWidth());
anim.setDuration(200);
anim.setInterpolator(new AccelerateDecelerateInterpolator());
view.startAnimation(anim);
}
}
});
While ResizeAnimation
is my own class who changes the view's LayoutParams
.
How do I solve the strange scrolling problem?
Thanks.