Android View Get changeViewState(View view, MotionEvent event)

Here you can find the source of changeViewState(View view, MotionEvent event)

Description

change View State

Declaration

public static void changeViewState(View view, MotionEvent event) 

Method Source Code

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

Related

  1. findInParents(View view, Class parentClass)
  2. findUsingTag(View v, int resourceId)
  3. getRandomView(int size)
  4. getname(Context mContext, View v)