当我在RelativeLayout中使用addView时:
for (BigClicleTagInfoBean info : bean.tags) {
BigClicleTagView tagView = null;
boolean isLeftTag = info.isLeftDirection();
if(isLeftTag) {
tagView = new BigClicleTagLeftView(this.getContext(), null);
} else {
tagView = new BigClicleTagRightView(this.getContext(), null);
}
tagView.setData(info);
tagView.setTagViewListener(this);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
int marginLeft = 0;
int marginRight = 0;
int marginTop = (int)(info.pos_y * pictureHeight) + 10;
if(isLeftTag) {
marginLeft = (int) (info.pos_x * Global.widthPixels);
} else {
marginRight = (int) ((1 - info.pos_x) * Global.widthPixels);
}
params.setMargins(marginLeft, marginTop, marginRight, 0);
imageRootRL.addView(tagView, params);
tagViews.add(tagView);
}
我希望照片标签显示完好,但在视图边框会挤出。 请帮助我,Thx