9

例外 java.lang.RuntimeException: Unable to bind views for Fragment on ButterKnife.bind(this, view) が発生します。コードは次のとおりです。

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_personal, container, false);

    ButterKnife.bind(this, view);

    BindData();

    return view;
}
4

3 に答える 3

9

この回答 をご覧ください カスタムBaseAdapterサブクラスでバターナイフを使用すると、「ビューを挿入できません」というエラーが発生します

ビュータイプまたはIDを間違える必要があるようです

于 2015-08-09T17:15:58.797 に答える
4

重複回答。とにかく私の問題(そしておそらくあなたの問題も)は次のとおりです。

<ImageView
    android:id="@+id/imageView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    />

次に、ImageView が別のクラス (ImageButton など) にバインドされます。

@Bind(R.id.imageView)
ImageButton notAnImageButton
于 2017-02-10T12:40:29.613 に答える