您的位置:首页 > 其它

如何设置ImageView的某一个方向的外边距

2014-10-04 17:09 232 查看
用到方法:ImageView的setLayoutParams(LayoutParams lp);

具体例子代码如下:

ImageView mImageView=(ImageView)findViewById(R.id.image);
android.widget.LinearLayout.LayoutParams lp=(android.widget.LinearLayout.LayoutParams)mImageView.getLayoutParams();
//设置自己需要的距离
lp.leftMargin=100;
mImageView.setLayoutParams(lp);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: