Set size of ImageView in px at runtime

喜你入骨 提交于 2019-12-01 14:37:34

Add the ImageViews with a fixed size, i.e.:

thumbs.addView (iv, new LayoutParams(thumbSize, thumbSize));

To answer (partially) the questions in the comments:

The ImageView API says:

takes care of computing its measurement from the image so that it can be used in any layout manager

so it is probably assuming 60px for a 160 dpi (I may be wrong there).

I'd suggest using this:

widthPx = getWindowManager().getDefaultDisplay().getWidth();
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!