Pretty much what the title says.
When you touch down on an item in a ListView you get a nice animation. I would like to play this animation when I touch a LinearLayout.
I imagine the code would be similar to:
final LinearLayout ll = (LinearLayout) getActivity().findViewById(R.id.ll);
ll.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Animation animation = null; // = ?
if(event.getAction() == MotionEvent.ACTION_DOWN) {
ll.startAnimation(animation);
} else if(event.getAction() == MotionEvent.ACTION_UP) {
ll.getAnimation().cancel();
ll.getAnimation().reset();
}
return true;
}
});