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 actual height of the list item.
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
final int initialHeight = view.getMeasuredHeight();
if(interpolatedTime == 1){
imageAdapter.remove(view, position);
}else{
view.getLayoutParams().height = initialHeight - (int)(initialHeight * interpolatedTime);
view.setAlpha(1 - interpolatedTime);
System.out.println(" v height = " + view.getHeight());
System.out.println(" v layoutparams = " + view.getLayoutParams().height);
view.forceLayout();
view.invalidate();
view.requestLayout();
}
}
this is in the getView method of the imadeAdapter and binBtn is the button which you touch to remove the listitem
binBtn.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
if (event.getAction() == MotionEvent.ACTION_UP)
{
View vp = (View) v.getParent();
SqueezeAnimation ani = new SqueezeAnimation(this,vp,position);
ani.setDuration(1000);
v.startAnimation(ani);
change to this code after Tanis' answer but still same problem, the getHeight() prints 674 and getLayoutParams().height prints 100
else{
RelativeLayout.LayoutParams lps = new RelativeLayout.LayoutParams(100, 100);
view.setLayoutParams(lps);
view.requestLayout();
System.out.println(" v height = " + view.getHeight());
System.out.println(" v layoutparams = " + view.getLayoutParams().height);
as a side note this is in the getView method of the imageadapter and that changes the height of that view, and ive tried passing in the backgroundfillIV to animate but still doesnt work
View backgroundfillIV = gridView.findViewById(R.id.backroundfillbar);
double mult = products.get(position).value/ products.get(0).value;
backgroundfillIV.getLayoutParams().height = (int) ( (((bottleheight+20)*0.95)/mult));