ButterKnife的使用(Fragment绑定)

1、Activity的绑定:
ButterKnife.bind(this);
2.Fragment的绑定
ButterKnife.bind(this,rootView);

@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_monitoring, container, false);
        ButterKnife.bind(this,rootView);
        return rootView;
    }

3.view绑定格式如下:
@BindView(R.id.ptz_control_ly)
LinearLayout linearLayoutControl;

你可能感兴趣的:(android)