Here you can find the source of changeViewState(View view, MotionEvent event)
public static void changeViewState(View view, MotionEvent event)
//package com.java2s; import android.view.MotionEvent; import android.view.View; public class Main { public static void changeViewState(View view, MotionEvent event) { if (view != null && event != null) { int action = event.getAction(); if (action == MotionEvent.ACTION_DOWN) { view.setPressed(true);//from www .jav a 2 s.c o m } else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { view.setPressed(false); } } } }