Java Code Examples for android.widget.RelativeLayout.LayoutParams

The following are Jave code examples for showing how to use LayoutParams of the android.widget.RelativeLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: photo-editor-android   File: PhotoEditorSDK.java   Source Code and License Vote up 7 votes
public void addText(String text, int colorCodeTextView) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    addTextRootView = inflater.inflate(R.layout.photo_editor_sdk_text_item_list, null);
    TextView addTextView = (TextView) addTextRootView.findViewById(R.id.photo_editor_sdk_text_tv);
    addTextView.setGravity(Gravity.CENTER);
    addTextView.setText(text);
    if (colorCodeTextView != -1)
        addTextView.setTextColor(colorCodeTextView);
    MultiTouchListener multiTouchListener = new MultiTouchListener(deleteView,
            parentView, this.imageView, onPhotoEditorSDKListener);
    multiTouchListener.setOnMultiTouchListener(this);
    addTextRootView.setOnTouchListener(multiTouchListener);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    parentView.addView(addTextRootView, params);
    addedViews.add(addTextRootView);
    if (onPhotoEditorSDKListener != null)
        onPhotoEditorSDKListener.onAddViewListener(ViewType.TEXT, addedViews.size());
}
 
Example 2
Project: photo-editor-android   File: PhotoEditorActivity.java   Source Code and License Vote up 6 votes
private void returnBackWithSavedImage() {
    updateView(View.GONE);
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    parentImageRelativeLayout.setLayoutParams(layoutParams);
    new CountDownTimer(1000, 500) {
        public void onTick(long millisUntilFinished) {

        }

        public void onFinish() {
            String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
            String imageName = "IMG_" + timeStamp + ".jpg";
            Intent returnIntent = new Intent();
            returnIntent.putExtra("imagePath", photoEditorSDK.saveImage("PhotoEditorSDK", imageName));
            setResult(Activity.RESULT_OK, returnIntent);
            finish();
        }
    }.start();
}
 
Example 3
Project: CosmoCalendar   File: CalendarView.java   Source Code and License Vote up 6 votes
private void createRecyclerView() {
    rvMonths = new SlowdownRecyclerView(getContext());
    rvMonths.setId(View.generateViewId());
    rvMonths.setHasFixedSize(true);
    rvMonths.setNestedScrollingEnabled(false);
    ((SimpleItemAnimator) rvMonths.getItemAnimator()).setSupportsChangeAnimations(false);

    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.BELOW, llDaysOfWeekTitles.getId());
    rvMonths.setLayoutParams(params);

    rvMonths.setLayoutManager(new GridLayoutManager(getContext(), 1, settingsManager.getCalendarOrientation(), false));
    monthAdapter = createAdapter();

    changeSnapHelper();

    rvMonths.setAdapter(monthAdapter);
    rvMonths.scrollToPosition(SettingsManager.DEFAULT_MONTH_COUNT / 2);
    rvMonths.addOnScrollListener(pagingScrollListener);
    rvMonths.getRecycledViewPool().setMaxRecycledViews(ItemViewType.MONTH, 10);
    addView(rvMonths);
}
 
Example 4
Project: Bartout   File: BarDetailsFragment.java   Source Code and License Vote up 6 votes
@Override
public void onStart() {
    super.onStart();
    Bundle b = getArguments();
    if (b != null) {
        LocationChronicleEvent loc = (LocationChronicleEvent) b.getSerializable(ARGUMENT_PLACE_JSON);
        locationChronicleEvent = loc;
        RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        p.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        p.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        //getView().setId(R.id.fragmentDetails);
        p.addRule(RelativeLayout.ALIGN_PARENT_START);
        getView().setLayoutParams(p);

        TextView textViewBarName = (TextView) getView().findViewById(R.id.textViewBarName);
        textViewBarName.setText(locationChronicleEvent.getLocationName());

        TextView textViewType = (TextView) getView().findViewById(R.id.textViewType);
        textViewType.setText(locationChronicleEvent.getType());
    }
}
 
Example 5
Project: airgram   File: ManageSpaceActivity.java   Source Code and License Vote up 5 votes
public void needLayout() {
    if (AndroidUtilities.isTablet()) {
        RelativeLayout.LayoutParams relativeLayoutParams = (RelativeLayout.LayoutParams)layersActionBarLayout.getLayoutParams();
        relativeLayoutParams.leftMargin = (AndroidUtilities.displaySize.x - relativeLayoutParams.width) / 2;
        int y = (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
        relativeLayoutParams.topMargin = y + (AndroidUtilities.displaySize.y - relativeLayoutParams.height - y) / 2;
        layersActionBarLayout.setLayoutParams(relativeLayoutParams);


        if (!AndroidUtilities.isSmallTablet() || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
            int leftWidth = AndroidUtilities.displaySize.x / 100 * 35;
            if (leftWidth < AndroidUtilities.dp(320)) {
                leftWidth = AndroidUtilities.dp(320);
            }

            relativeLayoutParams = (RelativeLayout.LayoutParams) actionBarLayout.getLayoutParams();
            relativeLayoutParams.width = leftWidth;
            relativeLayoutParams.height = LayoutHelper.MATCH_PARENT;
            actionBarLayout.setLayoutParams(relativeLayoutParams);

            if (AndroidUtilities.isSmallTablet() && actionBarLayout.fragmentsStack.size() == 2) {
                BaseFragment chatFragment = actionBarLayout.fragmentsStack.get(1);
                chatFragment.onPause();
                actionBarLayout.fragmentsStack.remove(1);
                actionBarLayout.showLastFragment();
            }
        } else {
            relativeLayoutParams = (RelativeLayout.LayoutParams) actionBarLayout.getLayoutParams();
            relativeLayoutParams.width = LayoutHelper.MATCH_PARENT;
            relativeLayoutParams.height = LayoutHelper.MATCH_PARENT;
            actionBarLayout.setLayoutParams(relativeLayoutParams);
        }
    }
}
 
Example 6
Project: shareNote   File: MainFragment.java   Source Code and License Vote up 5 votes
private void initStatusHeight() {
    int statusHeight = ScreenUtils.getStatusHeight(getActivity());
    ViewGroup.LayoutParams statusParams = status.getLayoutParams();
    statusParams.height = statusHeight;
    status.setLayoutParams(statusParams);

    ViewGroup.LayoutParams params = appbar.getLayoutParams();
    params.height = params.height + statusHeight;
    appbar.setLayoutParams(params);

    RelativeLayout.LayoutParams dl2Params = (RelativeLayout.LayoutParams) rootdl.getLayoutParams();
    dl2Params.topMargin = dl2Params.topMargin + statusHeight;
    rootdl.setLayoutParams(dl2Params);
}
 
Example 7
Project: GitHub   File: UnreadMsgUtils.java   Source Code and License Vote up 5 votes
public static void show(MsgView msgView, int num) {
    if (msgView == null) {
        return;
    }
    RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) msgView.getLayoutParams();
    DisplayMetrics dm = msgView.getResources().getDisplayMetrics();
    msgView.setVisibility(View.VISIBLE);
    if (num <= 0) {//圆点,设置默认宽高
        msgView.setStrokeWidth(0);
        msgView.setText("");

        lp.width = (int) (5 * dm.density);
        lp.height = (int) (5 * dm.density);
        msgView.setLayoutParams(lp);
    } else {
        lp.height = (int) (18 * dm.density);
        if (num > 0 && num < 10) {//圆
            lp.width = (int) (18 * dm.density);
            msgView.setText(num + "");
        } else if (num > 9 && num < 100) {//圆角矩形,圆角是高度的一半,设置默认padding
            lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT;
            msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0);
            msgView.setText(num + "");
        } else {//数字超过两位,显示99+
            lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT;
            msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0);
            msgView.setText("99+");
        }
        msgView.setLayoutParams(lp);
    }
}
 
Example 8
Project: Make-A-Pede-Android-App   File: JoystickView.java   Source Code and License Vote up 5 votes
private void centerDot() {
	RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) dot.getLayoutParams();

	params.leftMargin = (int) ((joystickWidth / 2f) - (dotSize / 2f));
	params.topMargin = (int) ((joystickHeight / 2f) - (dotSize / 2f));

	dot.setLayoutParams(params);
}
 
Example 9
Project: TextEmoji   File: EditPage.java   Source Code and License Vote up 5 votes
/** 动态适配编辑界面的高度 */
public void run() {
	int height = svContent.getChildAt(0).getHeight();
	RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams());
	if (height > maxBodyHeight && lp.height != maxBodyHeight) {
		lp.height = maxBodyHeight;
		svContent.setLayoutParams(lp);
	} else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
		lp.height = LayoutParams.WRAP_CONTENT;
		svContent.setLayoutParams(lp);
	}
}
 
Example 10
Project: buildAPKsSamples   File: CardFlip.java   Source Code and License Vote up 5 votes
/**
 * Adds a new card to the specified stack. Also performs all the necessary layout setup
 * to place the card in the correct position.
 */
public void addNewCard(int stack) {
    CardView view = new CardView(this);
    view.updateTranslation(mStackCards.get(stack).size());
    view.setCardFlipListener(this);
    view.setPadding(mHorizontalPadding, mVerticalPadding, mHorizontalPadding, mVerticalPadding);

    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(mCardWidth,
            mCardHeight);
    params.topMargin = 0;
    params.leftMargin = (stack == RIGHT_STACK ? mCardWidth : 0);

    mStackCards.get(stack).add(view);
    mLayout.addView(view, params);
}
 
Example 11
Project: AdPlayBanner   File: ScrollerPager.java   Source Code and License Vote up 5 votes
/**
 * 装载IndicatorView
 */
private void addIndicatorView() {
    if (IndicatorManager.getInstance().getIndicatorType() == POINT_INDICATOR && mIndicator != null) {
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        layoutParams.bottomMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, getContext().getResources().getDisplayMetrics());
        mContainer.addView(mIndicator, layoutParams);
    }
}
 
Example 12
Project: MultiSelecter   File: SuperSwipeRefreshLayout.java   Source Code and License Vote up 5 votes
/**
 * 添加头布局
 *
 * @param child
 */
public void setHeaderView(View child) {
    if (child == null) {
        return;
    }
    if (mHeadViewContainer == null) {
        return;
    }
    usingDefaultHeader = false;
    mHeadViewContainer.removeAllViews();
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
            mHeaderViewWidth, mHeaderViewHeight);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    mHeadViewContainer.addView(child, layoutParams);
}
 
Example 13
Project: Android_Songshuhui   File: UnreadMsgUtils.java   Source Code and License Vote up 5 votes
public static void setSize(MsgView rtv, int size) {
    if (rtv == null) {
        return;
    }
    RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) rtv.getLayoutParams();
    lp.width = size;
    lp.height = size;
    rtv.setLayoutParams(lp);
}
 
Example 14
Project: labelview   File: LabelView.java   Source Code and License Vote up 4 votes
private boolean replaceLayout(View target) {
    if (getParent() != null || target == null || target.getParent() == null || _labelViewContainerID != -1) {
        return false;
    }

    ViewGroup parentContainer = (ViewGroup) target.getParent();

    if (target.getParent() instanceof FrameLayout) {
        ((FrameLayout) target.getParent()).addView(this);
    } else if (target.getParent() instanceof ViewGroup) {

        int groupIndex = parentContainer.indexOfChild(target);
        _labelViewContainerID = generateViewId();

        // relativeLayout need copy rule
        if (target.getParent() instanceof RelativeLayout) {
            for (int i = 0; i < parentContainer.getChildCount(); i++) {
                if (i == groupIndex) {
                    continue;
                }
                View view = parentContainer.getChildAt(i);
                RelativeLayout.LayoutParams para = (RelativeLayout.LayoutParams) view.getLayoutParams();
                for (int j = 0; j < para.getRules().length; j++) {
                    if (para.getRules()[j] == target.getId()) {
                        para.getRules()[j] = _labelViewContainerID;
                    }
                }
                view.setLayoutParams(para);
            }
        }
        parentContainer.removeView(target);

        // new dummy layout
        FrameLayout labelViewContainer = new FrameLayout(getContext());
        ViewGroup.LayoutParams targetLayoutParam = target.getLayoutParams();
        labelViewContainer.setLayoutParams(targetLayoutParam);
        target.setLayoutParams(new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

        // add target and label in dummy layout
        labelViewContainer.addView(target);
        labelViewContainer.addView(this);
        labelViewContainer.setId(_labelViewContainerID);

        // add dummy layout in parent container
        parentContainer.addView(labelViewContainer, groupIndex, targetLayoutParam);
    }
    return true;
}
 
Example 15
Project: lqrwechatrongcloud   File: EditPageLand.java   Source Code and License Vote up 4 votes
private void initTitle(RelativeLayout rlTitle, float ratio) {
	tvCancel = new TextView(activity);
	tvCancel.setTextColor(0xff3b3b3b);
	tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvCancel.setGravity(Gravity.CENTER);
	int resId = ResHelper.getStringRes(activity, "ssdk_oks_cancel");
	if (resId > 0) {
		tvCancel.setText(resId);
	}
	int padding = (int) (DESIGN_LEFT_PADDING * ratio);
	tvCancel.setPadding(padding, 0, padding, 0);
	RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	rlTitle.addView(tvCancel, lp);
	tvCancel.setOnClickListener(this);

	TextView tvTitle = new TextView(activity);
	tvTitle.setTextColor(0xff3b3b3b);
	tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
	tvTitle.setGravity(Gravity.CENTER);
	resId = ResHelper.getStringRes(activity, "ssdk_oks_multi_share");
	if (resId > 0) {
		tvTitle.setText(resId);
	}
	lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	lp.addRule(RelativeLayout.CENTER_IN_PARENT);
	rlTitle.addView(tvTitle, lp);

	tvShare = new TextView(activity);
	tvShare.setTextColor(0xffff6d11);
	tvShare.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvShare.setGravity(Gravity.CENTER);
	resId = ResHelper.getStringRes(activity, "ssdk_oks_share");
	if (resId > 0) {
		tvShare.setText(resId);
	}
	tvShare.setPadding(padding, 0, padding, 0);
	lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	rlTitle.addView(tvShare, lp);
	tvShare.setOnClickListener(this);
}
 
Example 16
Project: LiuAGeAndroid   File: FriendListPage.java   Source Code and License Vote up 4 votes
private void initTitle(RelativeLayout rlTitle, float ratio) {
	tvCancel = new TextView(activity);
	tvCancel.setTextColor(0xff3b3b3b);
	tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvCancel.setGravity(Gravity.CENTER);
	int resId = ResHelper.getStringRes(activity, "ssdk_oks_cancel");
	if (resId > 0) {
		tvCancel.setText(resId);
	}
	int padding = (int) (DESIGN_LEFT_PADDING * ratio);
	tvCancel.setPadding(padding, 0, padding, 0);
	RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	rlTitle.addView(tvCancel, lp);
	tvCancel.setOnClickListener(this);

	TextView tvTitle = new TextView(activity);
	tvTitle.setTextColor(0xff3b3b3b);
	tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
	tvTitle.setGravity(Gravity.CENTER);
	resId = ResHelper.getStringRes(activity, "ssdk_oks_contacts");
	if (resId > 0) {
		tvTitle.setText(resId);
	}
	lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	lp.addRule(RelativeLayout.CENTER_IN_PARENT);
	rlTitle.addView(tvTitle, lp);

	tvConfirm = new TextView(activity);
	tvConfirm.setTextColor(0xffff6d11);
	tvConfirm.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvConfirm.setGravity(Gravity.CENTER);
	resId = ResHelper.getStringRes(activity, "ssdk_oks_confirm");
	if (resId > 0) {
		tvConfirm.setText(resId);
	}
	tvConfirm.setPadding(padding, 0, padding, 0);
	lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	rlTitle.addView(tvConfirm, lp);
	tvConfirm.setOnClickListener(this);
}
 
Example 17
Project: QMUI_Android   File: QMUITopBarLayout.java   Source Code and License Vote up 4 votes
public void addRightView(View view, int viewId, RelativeLayout.LayoutParams layoutParams) {
    mTopBar.addRightView(view, viewId, layoutParams);
}
 
Example 18
Project: PlusGram   File: LayoutHelper.java   Source Code and License Vote up 4 votes
public static RelativeLayout.LayoutParams createRelative(float width, float height, int leftMargin, int topMargin, int rightMargin, int bottomMargin, int alignRelative, int anchorRelative) {
    return createRelative(width, height, leftMargin, topMargin, rightMargin, bottomMargin, -1, alignRelative, anchorRelative);
}
 
Example 19
Project: Tower-Defense-Galaxy   File: AndroidLauncher.java   Source Code and License Vote up 4 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String mode = null;
    if(getIntent().getExtras() != null)
        mode = getIntent().getExtras().getString("mode");

    if (Build.VERSION.SDK_INT < 16)
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    gameHelper = new GameHelper(this, GameHelper.CLIENT_GAMES | GameHelper.CLIENT_SNAPSHOT);
    gameHelper.setup(this);
    helper = new BackupAgentHelper();
    //gameHelper.setConnectOnStart(true);

    final AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    config.useAccelerometer = true;
    config.useWakelock = true;
    config.useImmersiveMode = false;
    config.useGyroscope = true;
    //initialize(new TDGalaxy(this, null, this), config);
    View view = initializeForView(new TDGalaxy(mode,this, null, this, this), config);
    RelativeLayout layout = new RelativeLayout(this);
    MobileAds.initialize(this, Constants.ADSENSE_ID);

    banner = new AdView(this);
    banner.setAdSize(AdSize.SMART_BANNER);
    banner.setAdUnitId(Constants.AD_BANNER);
    banner.setBackgroundColor(Color.BLACK);

    rewardVideo = MobileAds.getRewardedVideoAdInstance(this);
    rewardVideo.setRewardedVideoAdListener(this);
    rewardVideo.loadAd(Constants.AD_VIDEO, new AdRequest.Builder().build());

    RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    adParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    layout.addView(view);
    layout.addView(banner, adParams);
    setContentView(layout);
    banner.setVisibility(View.VISIBLE);
}
 
Example 20
Project: MyFire   File: EditPagePort.java   Source Code and License Vote up 4 votes
private void initBody(RelativeLayout rlBody, float ratio) {
	svContent = new ScrollView(activity);
	rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

	LinearLayout llContent = new LinearLayout(activity);
	llContent.setOrientation(LinearLayout.VERTICAL);
	svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

	etContent = new EditText(activity);
	int padding = (int) (DESIGN_LEFT_PADDING * ratio);
	etContent.setPadding(padding, padding, padding, padding);
	etContent.setBackgroundDrawable(null);
	etContent.setTextColor(0xff3b3b3b);
	etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
	etContent.setText(sp.getText());
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llContent.addView(etContent, lp);
	etContent.addTextChangedListener(this);

	rlThumb = new RelativeLayout(activity);
	rlThumb.setBackgroundColor(0xff313131);
	int	thumbWidth = (int) (DESIGN_THUMB_HEIGHT * ratio);
	int	xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT * ratio);
	lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth);
	lp.leftMargin = lp.rightMargin = lp.bottomMargin = lp.topMargin = padding;
	llContent.addView(rlThumb, lp);

	aivThumb = new AsyncImageView(activity) {
		public void onImageGot(String url, Bitmap bm) {
			thumb = bm;
			super.onImageGot(url, bm);
		}
	};
	aivThumb.setScaleToCropCenter(true);
	RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth);
	rlThumb.addView(aivThumb, rllp);
	aivThumb.setOnClickListener(this);
	initThumb(aivThumb);

	xvRemove = new XView(activity);
	xvRemove.setRatio(ratio);
	rllp = new RelativeLayout.LayoutParams(xWidth, xWidth);
	rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
	rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	rlThumb.addView(xvRemove, rllp);
	xvRemove.setOnClickListener(this);
}