Android的getView()被称为列表视图的高度改变之后多次 [英] Android getView() called multiple times after listview height change

查看:210
本文介绍了Android的getView()被称为列表视图的高度改变之后多次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有这样的ListView,以高度的 fillparent ,然后主要是它采取了屏幕的一半大小,但事后我需要改变这个列表视图的父布局。在这里,我开始注意到该应用程序是freakeshly laging,经过一番诊断据我所知,从适配器在 getView()叫了这么多次,

so i have this listview, with the height of fillparent , and mainly it's taking half the size of the screen, but afterwards i need to change the parent layout of this listview. Here i start to notice that the app is freakeshly laging, after some diagnostic i understand that the getView() from the adapter is called so many times,

PS:我有这个问题的拳头时,列表视图高度在 wrapcontent 后,将其更改为 fillparent 解决了这个问题,但随着高度变化又来了,

PS: i had this issue at fist when the listview height was at wrapcontent, changing it to fillparent solved the issue, but came again with the height change,

请如果任何人有这个任何线索,这将是更AP preciated,
感谢所有

please if anyone has any clue about this, it would be much appreciated, thanks all

推荐答案

感谢您的所有球员,我得到了我的错误,
当我尝试改变其母公司的高度,我mistakly做
RelativeLayout.LayoutParams(ViewGroup.LayoutParams WRAP_CONTENT ,ViewGroup.LayoutParams WRAP_CONTENT );

Thank you all guys, i got my mistake, when i try to change the height of its parent, i mistakly did RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

将其更改为FILL_PARENT后,问题消失
再次感谢您的时间

after changing it to FILL_PARENT, the problem went away thanks again for your time

这篇关于Android的getView()被称为列表视图的高度改变之后多次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆