0

As we all know,if we want to use Butterknife to bind click event onto a normal view,we just need to declare the below method:

@onClick(R.id.yourview)
public void submit(){
     // do your things
}

But,how can I bind click event onto a view in a layout.

QuinnChen
  • 670
  • 1
  • 8
  • 29

1 Answers1

0

Answer is the same. You can do the same way:

@OnClick(R.id.yourview)
public void submit(){
    // do your things
}

When you have a inside a XML layout definition Android inflate all the content into a viewgroup replacing the include.

So, the view id is valid to do a reference like the code above.

Mou
  • 2,027
  • 1
  • 18
  • 29