Android View performClick() and callOnClick() difference

后端 未结 1 1169
说谎
说谎 2020-12-05 09:02

I think the title is self-explanatory. What is the difference in usage between the performClick() and callOnClick() methods? It seems that they wor

相关标签:
1条回答
  • 2020-12-05 09:41

    The Javadoc for both methods is pretty self-explanatory too:

    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.

    0 讨论(0)
提交回复
热议问题