如果我想在我的 ArrayAdapter 中重用 Fragment,那效率低吗?
也就是说,在 my 中ArrayAdapter
,mygetView()
看起来像这样:
public View getView(final int position, View convertView, ViewGroup parent) {
UserFragment userFragment = new UserFragment();
return userFragment.getView();
}
我问,因为通常在getView()
方法中,它看起来像这样:
public View getView(final int position, View convertView, ViewGroup parent) {
View view = convertView;
if (view == null) {
LayoutInflater inflater = (LayoutInflater) getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.user, null);
...//do stuff
}
每次调用 getView() 时创建 Fragment 是否效率低下?