private void createPreview() {
   Activity activity = getActivity();
   if (activity == null) return;
   if (mWindowSize == null) mWindowSize = new Point();
   activity.getWindowManager().getDefaultDisplay().getSize(mWindowSize);
   mPreviewView = new CameraPreview(getActivity(), mCamera);
   if (mPreviewFrame.getChildCount() > 0 && mPreviewFrame.getChildAt(0) instanceof CameraPreview)
     mPreviewFrame.removeViewAt(0);
   mPreviewFrame.addView(mPreviewView, 0);
   mPreviewView.setAspectRatio(mWindowSize.x, mWindowSize.y);
 }
  // 删除状态图片
  private void deleteNewsImageView(String tag) {
    // 删除
    int subviewsCount = addImageLayout.getChildCount();
    for (int i = 0; i < subviewsCount; i++) {
      View view = addImageLayout.getChildAt(i);
      if (null != view.getTag() && view.getTag().equals(tag)) {
        addImageLayout.removeViewAt(i);
        break;
      }
    }

    // 添加按钮位置重置
    MarginLayoutParams addlp = (MarginLayoutParams) addImageView.getLayoutParams();
    addlp.setMargins(oriMarginLeft, 0, 0, 0);
    // 删除之后重新排序
    subviewsCount = addImageLayout.getChildCount();
    for (int i = 1; i < subviewsCount; i++) {
      View view = addImageLayout.getChildAt(i);
      moveImageView((ImageView) view, i);
    }
  }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      RelativeLayout v;
      View child;

      // Log.d("mobeta",
      // "getView: position="+position+" convertView="+convertView);
      if (convertView != null) {

        v = (RelativeLayout) convertView;
        View oldChild = v.getChildAt(0);

        // child = super.getView(position, oldChild, v);
        child = mAdapter.getView(position, oldChild, v);
        if (child != oldChild) {
          // shouldn't get here if user is reusing convertViews
          // properly
          v.removeViewAt(0);
          v.addView(child);
          // check that tags are equal too?
          v.setTag(child.findViewById(R.id.drag));
        }

      } else {
        AbsListView.LayoutParams params =
            new AbsListView.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        v = new RelativeLayout(getContext());
        v.setLayoutParams(params);
        child = mAdapter.getView(position, null, v);
        v.addView(child);

        v.setTag(child.findViewById(R.id.drag));
      }

      ViewGroup.LayoutParams lp = v.getLayoutParams();
      final int numHeaders = getHeaderViewsCount();

      final int srcAdapter = mSrcDragPos - numHeaders;
      final int expAdapter = mExpDragPos - numHeaders;

      boolean itemIsNormal = position != srcAdapter && position != expAdapter;
      boolean listHasExpPos = mDragState == SRC_ABOVE || mDragState == SRC_BELOW;
      boolean itemNeedsWC = itemIsNormal || !listHasExpPos;

      int oldHeight = lp.height;
      if (itemNeedsWC && lp.height != ViewGroup.LayoutParams.WRAP_CONTENT) {
        // items that have a user-provided height
        lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
      } else if (listHasExpPos) {
        if (position == srcAdapter && lp.height != mItemHeightCollapsed) {
          // collapsed items
          lp.height = mItemHeightCollapsed;
        } else if (position == expAdapter) {
          // what if a previously-expanded wrapper view is used
          // as a convertView for a different expanded item?
          // Always measure child
          int spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
          child.measure(spec, spec);

          mExpandedChildHeight = child.getMeasuredHeight();
          // Log.d("mobeta",
          // "childh="+mExpandedChildHeight+" pos="+position);
          int height = mExpandedChildHeight + mFloatViewHeight;
          if (lp.height != height) {
            lp.height = height;
          }

          // set gravity
          if (mDragState == SRC_ABOVE) {
            v.setGravity(Gravity.TOP);
          } else {
            v.setGravity(Gravity.BOTTOM);
          }
        }
      }

      if (lp.height != oldHeight) {
        v.setLayoutParams(lp);
      }

      int oldVis = v.getVisibility();
      int vis = oldVis;

      if (position == srcAdapter && mDragState != NO_DRAG) {
        if (vis == View.VISIBLE) {
          vis = View.INVISIBLE;
        }
      } else if (vis == View.INVISIBLE) {
        vis = View.VISIBLE;
      }

      if (vis != oldVis) {
        v.setVisibility(vis);
      }

      return v;
    }