Thanks, Romain. Your suggestion is valid, because only 5 or so of the 20 views will be on the row at a time and the others will be hidden.
Maybe I should not use ViewInflate.inflate() at all but add those view that need to be on the row programmatically. Nick. On Jun 11, 2:44 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote: > Hi, > > XML inflation is slow but on real hardware it is not as slow as you > describe. However, remember you are developing for a cell phone. Even > if inflating your views was fast, having so many views on screen > (you're talking about 20 views per row in a LinearLayout) will impact > layout, drawing, scrolling and memory performance. You should > seriously consider simplifying this XML file and limit the number of > views you need on screen. > > > > On Wed, Jun 11, 2008 at 3:37 PM, Nickname <[EMAIL PROTECTED]> wrote: > > > Thanks, Mark. > > > I do reuse the "convertView parameter" when it is not null. > > > The parameter is null at the first time when a listview displays, and > > it takes long long long time to finish. > > > Nick. > > > On Jun 11, 2:14 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > >> Nickname wrote: > >> > Hi, > > >> > As title, ViewInflate.inflate() takes about 500ms-1sec to inflat an > >> > XML layout file defining a LinearLayout objects containing two > >> > LinearLayout objects each with about 10 Views objects. > > >> > With a ListView of 20 entries, each of the same layout, it will take > >> > 10-20 seconds to finish layout the entire ListView. > > >> > Is there any faster way to achieve it? For example, faster inflate API > >> > or some API to "clone" the first inflated entry to obtain remaining 19 > >> > entries? > > >> When you say 20 entries, do you mean you anticipate 20 lines being > >> visible at one time? Or do you mean the list will have 20 total entries, > >> of which some subset will be visible at once? > > >> If the latter, you may be able to take advantage of the passed-in View > >> convertView parameter to your list adapter's getView() implementation. > >> If non-null, this represents a View you already inflated, but whose > >> contents need to change to represent the supplied item position. Just > >> cast it to the proper View class and update the innards as needed. This > >> will cut the inflations down to only as many lines as are visible. > > >> -- > >> Mark Murphy (a Commons Guy)http://commonsware.com > >> Warescription: All titles, revisions, & ebook formats, just $35/year > > -- > Romain Guywww.curious-creature.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

