相关疑难解决方法(0)

如何使用代码而不是xml设置ImageView的边距

我想ImageView用边距为我的布局添加未知数量的视图.在XML中,我可以layout_margin像这样使用:

<ImageView android:layout_margin="5dip" android:src="@drawable/image" />

ImageView.setPadding(),但没有ImageView.setMargin().我认为这是顺利的ImageView.setLayoutParams(LayoutParams),但不确定该提供什么.

有人知道吗?

android margin imageview

170
推荐指数
9
解决办法
26万
查看次数

标签 统计

android ×1

imageview ×1

margin ×1