How to use ButterKnife inside adapter

后端 未结 3 1892
后悔当初
后悔当初 2021-02-13 16:12

I would like to use ButterKnife to bind my views inside listView adpater.

I tried this, but i can not simply use my \"spinner\" var.

public class WarmSpi         


        
3条回答
  •  一个人的身影
    2021-02-13 17:08

    You should pass your view to ButterKnife to bind it first.

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View v = LayoutInflater.from(context).inflate(R.layout.item_spinner, null);
        ButterKnife.bind(this,v);
    
        return v;
    }
    

    Then you will have access to your Views.

提交回复
热议问题