SoFunction
Updated on 2025-04-09

ImageView click on the dimmable instance code (android code skills)

ImageView click on the dimmable instance code (android code skills)

Updated: February 6, 2017 10:57:34 Submission: mrr
This article will share with you an example code to introduce the example code that can be dimmed by ImageView. It is very good and has reference value. If you need it, please refer to it.

I won’t say much nonsense, I will just post the code to you. The specific code is as follows:

import ;
import ;
import ;
import ;
import ;
import ;
public class MyImageView extends ImageView{
  public MyImageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    // TODO Auto-generated constructor stub
    (VIEW_TOUCH_DARK);
  }
  public static final OnTouchListener VIEW_TOUCH_DARK = new OnTouchListener() { 
    //Dark (three -50, the larger the value, the deeper the effect)    public final float[] BT_SELECTED_DARK = new float[] { 1, 0, 0, 0, -50, 0, 1, 
        0, 0, -50, 0, 0, 1, 0, -50, 0, 0, 0, 1, 0 };
    /*
     //Brighten
     public final float[] BT_SELECTED_LIGHT = new float[] { 1, 0, 0, 0, 50, 0, 1,
         0, 0, 50, 0, 0, 0, 1, 0, 50, 0, 0, 0, 1, 0 };
     //recover
     public final float[] BT_NOT_SELECTED = new float[] { 1, 0, 0, 0, 0, 0,
         1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0 };
      */
    @Override 
    public boolean onTouch(View v, MotionEvent event) { 
      if (() == MotionEvent.ACTION_DOWN) {
        ImageView iv = (ImageView) v; 
        (new ColorMatrixColorFilter(BT_SELECTED_DARK));
      } else if (() == MotionEvent.ACTION_UP) {
        ImageView iv = (ImageView) v; 
        ();
      } 
      return false; //If false, no further execution will be performed after executing ACTION_DOWN    } 
  }; 
}

The above is the example code (android code skills) that the editor introduces to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!

  • imageview
  • Click
  • darken

Related Articles

  • android adds events to the button above each Item of ListView

    This article mainly introduces android to add events to the buttons on each Item of ListView. Interested students can learn about it.
    2016-11-11
  • A complete example of RegexUtil, a very useful regular expression tool class in Android development

    This article mainly introduces RegexUtil, a very useful regular expression tool class in Android development. It analyzes common operating techniques for Android regular expressions in combination with complete examples, including relevant operating techniques for regular judgments for ID numbers, bank accounts, mobile phone numbers, postal codes, etc. If you need it, you can refer to the following
    2017-11-11
  • Android ActionBar clock instance analysis

    This article mainly introduces the implementation code of Android ActionBar clock production in detail. The sample code in the article is introduced in detail and has certain reference value. Interested friends can refer to it.
    2016-05-05
  • Android stability: Remotely configurable Looper guarantee framework

    This article mainly introduces a detailed explanation of the instance of the Looper bottom-up framework that can be configured with Android stability and remote configuration. Friends in need can refer to it for reference. I hope it can be helpful. I wish you more progress and get promoted as soon as possible to get a salary increase as soon as possible.
    2023-02-02
  • Android development: WeChat authorization login and WeChat sharing are fully analyzed

    This article mainly introduces Android WeChat authorization login and WeChat sharing, which has certain reference value. If you need it, you can learn about it.
    2016-11-11
  • Example of Android login password information for RSA encryption

    Recently, I encountered such a requirement in the project. I encrypted the login password. After searching for information online, I decided to use RSA confidential technology to encrypt the password.
    2017-02-02
  • Android APP writing a simple answerer

    This article mainly introduces in detail to you the writing of a simple answerer for Android APP, which has certain reference value. Interested friends can refer to it.
    2018-01-01
  • Android uses sensor to imitate WeChat shake function

    This article mainly introduces the function of Android using sensors to imitate WeChat shake. The sample code in the article is introduced in detail and has a certain reference value. Interested friends can refer to it.
    2017-05-05
  • Solution to simulate GPS functionality always null on Android emulator

    When we develop, we need to simulate GPS on the simulator. We can always null when Location. Let’s share with you the specific solutions. Interested friends can refer to it.
    2013-06-06
  • Android Getting Started: Detailed introduction to downloading multi-threaded breakpoints

    This article mainly introduces Android multi-threaded breakpoint download, that is, after a part of the download is interrupted, you can continue to download it in progress. If you need it, you can learn about it.
    2016-11-11

Latest Comments