开发者

Event handling for button

开发者 https://www.devze.com 2023-03-15 20:12 出处:网络
I have created a button. Now I want to do: A single click of a button will open a dialog. Double click of a button will open a dial pad.

I have created a button. Now I want to do:

  1. A single click of a button will open a dialog.
  2. Double click of a button will open a dial pad.
  3. OnLongtouchpress of buttons I want to change开发者_StackOverflow社区 the color of the button.

Now in my case, I have used a single click event. So I want to know is there any option for double click and onlongtouchpress event on the same button if so, please suggest to me. With examples, if it is possible.

Regards Anshuman


Use button.setOnLongClickListener to handle onLongclick event

For double click event See the followig URL

http://mobile.tutsplus.com/tutorials/android/android-gesture/


You need to set specify listeners.

Button btn = (Button)findVieByID(R.id.button1);
btn.setOnClickListener(.....);
btn.setOnLongClickListener(.....);

setOnDoubleTapListener not existing for Button

0

精彩评论

暂无评论...
验证码 换一张
取 消