简体   繁体   English

如何获取画布中的按钮单击事件-Android?

[英]how to get event of click of button in canvas — Android?

有人请告诉我如何获取按钮单击事件,画布中的按钮--- Android吗?

I think you can use onclickListener according to what i understood from your question. 我认为您可以根据我对您的问题的理解使用onclickListener。

Eg; 例如; Button button = (Button)findViewById(your button id); Button button =(Button)findViewById(您的按钮ID);

button.setOnClickListener(this); button.setOnClickListener(this);

implement onClickListener. 实现onClickListener。

Add the methods,then do the codings for what you want to do. 添加方法,然后对要执行的操作进行编码。

要捕获当用户点击一个按钮的情况下,你需要调用setOnItemClickListener该按钮,并定义onClickListener该方法通常内。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM