无法在ButterKnife中使用findById

问题描述 投票:0回答:1

我在ButterKnife中遇到此错误:

错误:找不到符号方法findById(View,int)

TextView tvHeaderTextOne = ButterKnife.findById(headerView, R.id.tv_header_text_one);

更新到Butterknife 10之后,出现错误,无法显示findById

java android butterknife
1个回答
0
投票

定义道具

@BindView( R.id.tv_header_text_one)
protected TextView tx ;

在OnCreate方法中:

ButterKnife.bind(this,yourview);
© www.soinside.com 2019 - 2024. All rights reserved.