简体   繁体   中英

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); because its deprecated.

I need this because if i use the android findViewBy() it will not listen to the @onClick() notation for the ButterKnife.

Note : I am using 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 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM