Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BaseFragement 无Butterknife和mView对象 #126

Closed
coolBreezes opened this issue Aug 8, 2017 · 5 comments
Closed

BaseFragement 无Butterknife和mView对象 #126

coolBreezes opened this issue Aug 8, 2017 · 5 comments

Comments

@coolBreezes
Copy link

请问为什么不在BaseFragament中使用butterknift
和创建view对象呢,像这样
@nullable
@OverRide
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mInflater = inflater;
if (null == rootView){
rootView = inflater.inflate(getLayoutId(),null);
ButterKnife.bind(this,rootView);
}else {
ViewGroup viewGroup = (ViewGroup) rootView.getParent();
if (null != viewGroup){
viewGroup.removeView(rootView);
}
}
return rootView;
}

@JessYanCoding
Copy link
Owner

因为我在其他地方已经做了,你使用框架, 你不用担心 bind 的问题, butterknife 是可以正常使用的

@coolBreezes
Copy link
Author

那请问一下,您是在哪里对butterknife进行绑定和回收的呢

@luocaca
Copy link

luocaca commented Aug 9, 2017

FragmentDelegateImpl 里面代理了 绑定。。
image

你直接ctrl + alt + F 搜索一下 ButterKnife.bind 关键字就出来了

@coolBreezes
Copy link
Author

恩,好的,太感谢了o( ̄︶ ̄)o

@Sum41forever
Copy link
Contributor

详细解答在这里,把相同的问题定位在一起
Fragment在框架中的使用,ButterKnife的绑定

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants