Can not resolve method 'findViewById(int)'

前端 未结 9 836
孤城傲影
孤城傲影 2021-02-05 03:08

I\'m having a trouble with findViewByid but I can\'t find where the problem is.

Here\'s my FirstFragment class code:

import and         


        
9条回答
  •  温柔的废话
    2021-02-05 03:25

    Add getView() before findViewById() method.

    Like this:

    getView().findViewById(R.id.potatoes);

提交回复
热议问题