How to handle button clicks using the XML onClick within Fragments

前端 未结 18 1518
旧时难觅i
旧时难觅i 2020-11-22 01:41

Pre-Honeycomb (Android 3), each Activity was registered to handle button clicks via the onClick tag in a Layout\'s XML:

android:onClick=\"m         


        
18条回答
  •  不思量自难忘°
    2020-11-22 02:03

    As I see answers they're somehow old. Recently Google introduce DataBinding which is much easier to handle onClick or assigning in your xml.

    Here is good example which you can see how to handle this :

    
    
       
           
           
       
       
           
           
       
    
    

    There is also very nice tutorial about DataBinding you can find it Here.

提交回复
热议问题