Skip to content Skip to sidebar Skip to footer

Layoutparams Not Changing

I am trying to animate a horizontal list item dismiss the alpha animation works and the layoutparam values also decrease over time but for some reason that doesn't change the actua

Solution 1:

You need to call setLayoutParams() at some point to save your changes to the LayoutParams.

For example:

LayoutParamslps= view.getLayoutParams();
lps.height = initialHeight - (int)(initialHeight * interpolatedTime);
view.setAlpha(1 - interpolatedTime);
view.setLayoutParams(lps);

This is because the getLayoutParams() method is only returning a copy of the LayoutParams reference, not a reference to the LayoutParams themselves. There is a bit more in-depth discussion on this at Does Java return by reference or value.

Solution 2:

Not really a solution but the problem is with the HorizontalListView that I found because it works for a normal listview

Post a Comment for "Layoutparams Not Changing"