Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 android 应用项目需要在我的活动中添加一个保存某些视图(例如按钮、图片等)的点击次数的新功能。如何以适当的方式解决这个问题(从架构的角度来看)?我应该覆盖所有的 onClick() 吗?
您可以通过设置 onClickListener 并更新全局计数器来捕获它
您应该将 an 设置为所需的视图,将点击计数存储在一个字段中,并在操作发生onclicklistener时增加该字段。onClick()
onclicklistener
onClick()