如何设置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);
相关文章推荐
- 如何动态设置ImageView的宽高以及位置
- android 如何把一个 RelativeLayout或ImageView背景设为透明
- Android 如何把一个 RelativeLayout或ImageView背景设为透明
- 如何设置光标距离左边的位置,为我们的textfield添加一个Leftview
- 如何在圆形 imageView android 上添加一个阴影和边界?
- 如何动态的获取和设置ImageView的宽度和高度?
- Android学习笔记:如何设置ImageView中图片的显示方式
- 在安卓开发中如何在代码中设置ImageView中src中这个参数
- android 如何把一个 RelativeLayout或ImageView背景设为透明
- 一个关于 imageView 设置 scaleType 的问题
- android中,如果使用imageButton可以在drawable 中设置一个selector,但是imageView设置不起作用
- 如何使用代码动态的获取和设置ImageView的宽度和高度?
- 当一个imageview 使用了 setimagebitmap(bit); 之后 如何从imageview中获取到bit
- 如何自定义一个View,并动态设置style?
- 如何让一个button 的 backgroundimage 等比例缩放 background imageview 并不完美
- 如何在代码中设置imageview的大小
- 在Android中如何获取视频的第一帧图片并显示在一个ImageView中
- 如何设置一个textview的文字显示为垂直居中,水平居左呢
- 如何使用代码动态的获取和设置ImageView的宽度和高度?
- 如何去绘制一个圆并且转为imageView格式