@Override public void onStart() { super.onStart(); // 初始化数据 initData(); brainAdapter = new BrainAdapter(context, brainItems); xListView.setAdapter(brainAdapter); }
@Nullable @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootview = inflater.inflate(R.layout.fragment_brain_fragment_best, container, false); // 获得控件 xListView = (XListView) rootview.findViewById(R.id.xlistview_brain_best); // 必要操作 xListView.setPullLoadEnable(true); context = getActivity(); return rootview; }