Android GridView与ImageVIew 怎么才能一致?
巴扎黑
巴扎黑 2017-04-18 09:18:02
0
3
541

需求是现实图片分别用ImageVIew 和GridView来显示
1.上方的ImageView显示一张图片
2.下方的GridView显示两张图片
问题来了,我的下方的GridVIew显示的图片效果怎么和上方的ImageVIew显示的大小宽高一致呢?
如图:上方的ImageVIew图片和下方的GridView显示的效果不一致,ImageVIew宽度不够!! 但是怎么计算这个ImageVIew的宽度和下方的GridVIew一致呢??? 求解。!

巴扎黑
巴扎黑

reply all(3)
大家讲道理

Isn’t the width of Imageview the same as the width of grpiew?

小葫芦

I thought about it too, but the width of my GridView is not set to a fixed value. Now it is content-adaptive. And I also tried to get the width of the GridView, but the value obtained is not fixed, with values ​​ranging from 1000 to 200 to 500. Not sure what's going on...

伊谢尔伦

The width of the gridview should fill up the parent container. If you know the number of columns displayed by the gridview below, then you can use LinearLayout to nest the Imageview above, set the weight of the Imageview, and that's it.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template