gpt4 book ai didi

java - Android查看performClick()和callOnClick()的区别

转载 作者:IT老高 更新时间:2023-10-28 13:25:31 28 4
gpt4 key购买 nike

performClick()callOnClick()在用法上有什么区别?看起来他们的工作方式是一样的,那为什么View有两个方法呢?

最佳答案

这两种方法的 Javadoc 也很容易解释:

public boolean performClick ()

Added in API level 1

Call this view's OnClickListener, if it is defined. Performs all normal actions associated with clicking: reporting accessibility event, playing a sound, etc.


public boolean callOnClick ()

Added in API level 15

Directly call any attached OnClickListener. Unlike performClick(), this only calls the listener, and does not do any associated clicking actions like reporting an accessibility event.

关于java - Android查看performClick()和callOnClick()的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18249554/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com