Bind ButterKnife to Dialog fails

后端 未结 3 1393
忘掉有多难
忘掉有多难 2021-02-07 11:34

I try to bind ButterKnife to a AleterDialog that i made with a DialogBuilder method And exist this method ButterKnife.bind(Object,Dialog); but dosen\'t work for me<

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-07 12:39

    You need to inflate your dialog layout and pass the resulting View object to butterknife.

        view = View.inflate(getContext(), R.layout.accountlist_dialog_user_, null);
        ButterKnife.bind(this, view);
    

    At least, that's how I've used Butterknife in dialogs and it works fine for me.

提交回复
热议问题