开发者

Event handling for button

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜