[英]How to bind view inflated in activity after bind all the views with ButterKnife
I need to bind views inflated after binding the activity views with butter knife without using ButterKnife.findById(this,view);
我需要在不使用
ButterKnife.findById(this,view);
用黄油刀将活动视图绑定后,将膨胀的视图绑定ButterKnife.findById(this,view);
because its deprecated. 因为它已弃用。
I need this because if i use the android findViewBy()
it will not listen to the @onClick()
notation for the ButterKnife. 我需要这个,因为如果我使用android
findViewBy()
,它将不会监听@onClick()
表示法。
Note : I am using ButterKnife 8.8.1 注意:我正在使用ButterKnife 8.8.1
I am not sure if this is what you're looking for, but you can bind the view when declaring the variables. 我不确定这是否是您要查找的内容,但是可以在声明变量时绑定视图。 It should bind your view instances.
它应该绑定您的视图实例。
@BindView(R.id.button) Button mButton;
@OnClick(R.id.button)
public void onButtonClicked(View view) {
// TODO
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.