开发者

Android listview row pressed animation

In my app, I have a custom listview. User can press a row of the listview and then another activity(detail of row) becomes visible. My question is, After user click, I want to show an click animation to the button before detailed activity becomes visible (note this state is not 'pressed state', is 'after pressed'). At first, I thought I could make this by selectors. But as far as I know, selectors can animate at pressed, focused states. After hands-of开发者_JAVA技巧f, click animaton becomes invisible. But I need a click animation through the transition.

How can I do this ?

Thanks in advance..


I don't know if there's an easier way to do this, but this is what I would do. For your ListView, set it an onItemClickListener like this:

listView.setOnItemClickListener(AdapterView<?> parent, View view, int position, long id) {
        view.startAnimation(animation);
        // do everything else when the user clicks on an item
}

And for the object animation, design it in XML, and turn it into an Animation object like this:

Animation animation = AnimationUtils.loadAnimation(context, R.anim.animation);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜