I got a ListView with items in it. When the user clicks an item it's height should scale to zero and all items below should scroll up. My code below doesnt work. With my code the item which was clicked scales right, but the items below dont scroll up, they stay at the same position. I've also tried it with an LinearLayout but there is the same problem.
There is an app which does this right. It's called Tasks.
My current implementation looks like this:
@Override
public void onItemClick(AdapterView<?> arg0, View v, final int index,
long id) {
Animation anim = AnimationUtils.loadAnimation(getActivity(),
R.anim.scaleup);
v.startAnimation(anim);
}
<set android:shareInterpolator="false" >
<scale
android:duration="700"
android:fillAfter="false"
android:fillBefore="false"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:pivotY="0%"
android:toXScale="1.0"
android:toYScale="0.0" />
</set>
Here's a class I made (modified from source I found here) that may give you the functionality you want.
Then this is how I'm using it
You can play with it to see if you can get it to fit your needs.
Will you use the clicked item again? If not, then you could
The Android don't act like HTML, when you change the width, height or visibility in a view, the other views don't update theirs positions. If you need to do that, you must update all the listview and your views inside, individually. This is a complex code to do.