ListView的膨胀问题 [英] ListView inflating issue

查看:168
本文介绍了ListView的膨胀问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立短信应用程序,并需要出示根据来电/去电短信的看法。
我现在面临的以下问题,在我的 getView(..)我需要知道,如果它的来电/去电,然后显示以下内容:

I'm building an sms app, and need to show the view according to Incoming/Outgoing sms. I'm facing the following issue, in my getView(..) I need to know if it's Incoming/Outgoing and then to show the following:

来电VIEW

传出VIEW

但我不能想办法来实现1视图来处理这个(因为列表视图中回收的)。

But i can't think of a way to implement 1 view to handle this (because of the recycling in listview).

我想在的LinearLayout使用setLayoutDirection,或者removeViews,然后将它们添加在正确位置。可否请您用较少性能的最佳方式帮助我?

I thought of using setLayoutDirection in a LinearLayout, or maybe removeViews and then add them in correct position. Can you please assist me with the best way with the less performance?

非常感谢

推荐答案

您可以覆盖getViewType方法,以precise你如何行许多种的ListView了。

You can override the getViewType method in order to precise how many kind of rows you listview has.

看一看这里

这篇关于ListView的膨胀问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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