示例#1
0
  @Override
  public void initData(Activity activity) {
    super.initData(activity);
    mXQActivity = (XQActivity) activity;
    mAdapter =
        new SimpleArrayAdapter<DataHolder>(activity, 0, mDatas) {
          public int getItemViewType(int position) {
            return mDatas.get(position).mType;
          }

          public int getViewTypeCount() {
            return 5;
          }

          @Override
          public View getView(int position, View convertView, ViewGroup parent) {
            final DataHolder data = getItem(position);
            final ViewHolder viewHolder;
            if (convertView == null) {
              viewHolder = new ViewHolder(data);
              convertView = viewHolder.mConvertView;
            } else {
              viewHolder = (ViewHolder) convertView.getTag();
            }
            viewHolder.handleView(position, convertView, parent);
            return convertView;
          }
        };
  }
示例#2
0
 @Override
 public void onViewCreated(View view, Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
   initView(view);
   update();
 }