ButterKnife:ViewPager上片段重新创build后的空视图

我正在使用Butterknife(8.2.1)的最新版本,我遇到了一个问题:在使用带有3个碎片的ViewPager时,当碎片被重新创build时,所有视图都变为空! 前两个碎片,没问题,但是当我刷到第三个,回到第一个碎片时,每个视图变为空。 可能是什么问题呢?

我添加了ButterKnife.setDebug(true); 获得更多关于这个问题的信息,我得到这个:

 D/ButterKnife: Looking up view binder for com.example.overview.MeetupOverviewFragment D/ButterKnife: HIT: Cached in view binder map. D/ButterKnife: Looking up view binder for com.example.attendees.MeetupAttendeesFragment D/ButterKnife: HIT: Cached in view binder map. D/ButterKnife: Looking up view binder for com.example.attendees.ControllerListAttendees$ItemViewHolder D/ButterKnife: HIT: Cached in view binder map. D/ButterKnife: Looking up view binder for com.example.attendees.ControllerListAttendees$ItemViewHolder D/ButterKnife: HIT: Cached in view binder map. D/ButterKnife: Looking up view binder for com.example.attendees.ControllerListAttendees$ItemViewHolder D/ButterKnife: HIT: Cached in view binder map. I/InjectionManager: dispatchCreateOptionsMenu :com.example.MeetupDetailActivity I/InjectionManager: dispatchPrepareOptionsMenu :com.example.MeetupDetailActivity 

对于碎片(正如wiki所说)我正在这样做:

 public class MeetupDocumentsFragment extends Fragment { @BindView(R.id.list) CustomRecyclerView recyclerView; private Unbinder unbinder; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state) { View v = inflater.inflate(R.layout.my_layout, container, false); unbinder = ButterKnife.bind(this, v); return v; } @Override public void onDestroyView() { super.onDestroyView(); unbinder.unbind(); } } 

对于RecyclerViewAdapters我使用这个代码:

 public class ControllerListAttendees extends RecyclerView.Adapter<ControllerListAttendees.ItemViewHolder> public static class ItemViewHolder extends RecyclerView.ViewHolder { @BindView(R.id.some_imageview) ImageView imageAvatar; @BindView(R.id.some_label1) TextView labelName; @BindView(R.id.some_label2) TextView labelSurname; @BindView(R.id.some_label3) TextView labelAge; public ItemViewHolder(View v) { super(v); ButterKnife.bind(this, v); } } } 

在此期间,我可以将ViewPager的OffscreenPageLimit设置为2,以避免娱乐,但是…我宁愿这样做正确的方式:)

谁能帮我这个?

Solutions Collecting From Web of "ButterKnife:ViewPager上片段重新创build后的空视图"