问题描述
- 动态添加的relativelaout,addrule失效
-
本来我的想法是可以使delImg置于右上角的,但现在是出现在左上角,望各位大神帮个忙,多谢ImageView delImg = new ImageView(ReleaseActivity.this); delImg.setImageResource(R.drawable.shan); RelativeLayout.LayoutParams delParams = new LayoutParams( util.DensityUti.dip2px(ReleaseActivity.this, 15), util.DensityUti.dip2px(ReleaseActivity.this, 15)); delParams.alignWithParent = true; delParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); delParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); relativeLayout.addView(imageView); relativeLayout.addView(delImg, delParams);
解决方案
http://blog.csdn.net/fancylovejava/article/details/17285987
解决方案二:
我试过加ID,但没用
解决方案三:
alignWithParent去掉看看
时间: 2024-11-01 08:33:28