[Android Pro] listView和GridView的item设置的高度和宽度不起作用


referece to : http://blog.csdn.net/beibeixiao/article/details/9032569

1.     在Android开发中会发现,有时listView和GridView的item顶层布局不起作用,即不能设置高度和宽度

        原因是当用自定义的adapter时,如果使用convertView= mInflater.inflate(R.layout.material_grid_item, null)

方法就不会起作用,这个 方法的第二个参数是父View,传入为空,所以没有加载顶层布局,此时如果使用

convertView= mInflater.inflate(R.layout.material_grid_item, parent,false);传入parent设置的高度和宽度就会起作用了。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM