barisatbas
barisatbas

Reputation: 564

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-off, click animaton becomes invisible. But I need a click animation through the transition.

How can I do this ?

Thanks in advance..

Upvotes: 0

Views: 2754

Answers (1)

Brian
Brian

Reputation: 8095

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);

Upvotes: 1

Related Questions