I have a linearlyaout(A) with couple of textviews,image etc and scrollview (B) with a listview. Onscroll of the list view I would like to reduce the height of the image. The height should be reduced to half the size of the image when the user goes down the list. When the user scrolls up the list, I would like to increase the height to the original height.
I have managed to get it to work using the following code
if (scrolledUp) {
int height = linearLayout.getMeasuredHeight();
int setHeight = height - scrollValue;
linearLayout.getLayoutParams().height = setHeight;
linearLayout.requestLayout();
}
The problem I am facing is, the frequent calls to requestLayout() is making the scrollview scrolling horribly slow and shuddery. How can I improve the implementation to make the scroll smoother?