动画拆除一个ListView项目 [英] Animate the removal of a ListView item

查看:60
本文介绍了动画拆除一个ListView项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用这个动画的去除ListView项的:

I'm attempting to animate the removal of a ListView item using this:

    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, final View view, final int i, long l) {
            view.animate().setDuration(500).x(-view.getWidth()).alpha(0f);
            adapter.remove(tasks.get(i));
            adapter.notifyDataSetChanged();
        }
    });

这是行不通的。我基本上遵循了4回答的意见,从这个帖子顶:

It does not work. I basically followed the advice of the 4th answer from the top of this post:

<一个href="http://stackoverflow.com/questions/3928193/how-to-animate-addition-or-removal-of-android-listview-rows">How为动画添加或删除Android的ListView的行

不过,有一些有趣的绘画的东西怎么回事,或者回收或东西,因为虽然动画时,下面的一个滑出屏幕的项目也被删除出于某种原因。这个问题提问者最终标记为正确的答案是不幸对整个Android的源的RTFM。我经过那里看着,我找不到通知下拉豆形软糖中,我试着效仿。

However, there's some funny drawing stuff going on, or recycling, or something because while the animation occurs, the item below the one that slides off screen also gets deleted for some reason. The answer that the question asker eventually marked as correct is unfortunately an RTFM towards the whole of Android's source. I've looked through there, and I can't find the notifications pull-down in JellyBean which I'm trying to emulate.

TIA。 约翰·

推荐答案

我刚刚发现了一个漂亮的解决办法:<一href="https://github.com/paraches/ListViewCellDeleteAnimation">https://github.com/paraches/ListViewCellDeleteAnimation

I just found a beautiful solution: https://github.com/paraches/ListViewCellDeleteAnimation

下面的视频: http://www.youtube.com/watch?v=bOl5MIti7n0

非常感谢'paraches')

Many thanks to 'paraches' ;)

这篇关于动画拆除一个ListView项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆