comparison between viewstub and latoutinflater to add view at runtime?

by Hitendrasinh Gohil » Thu, 19 May 2011 21:55:52 GMT

Sponsored Links

What is the difference between using viewstub and layoutinflater to
inflate views at runtime?


Re: comparison between viewstub and latoutinflater to add view at runtime?

by Diego Tori » Thu, 19 May 2011 22:41:18 GMT

 If I recall correctly, ViewStub acts as a lazy XML include, in that the 
referenced view only gets added to the view hierarchy in the time that it's 
inflated, not ahead of time. The gain on this method is that it makes it 
quick and cheap to inflate a view, however, once it's inflated, it cannot be 
recreated or re-inflated (since the VS reference is gone from the 
heirarchy). LayoutInflater on the other hand allows you to inflate views at 
will, and add them directly into the heirarchy, however, you have to deal 
with the overhead of inflating them.


Sponsored Links

Re: Re: comparison between viewstub and latoutinflater to add view at runtime?

by Dianne Hackborn » Fri, 20 May 2011 00:13:16 GMT

 I'm not sure it makes sense to compare them.  ViewStub is a view that uses
LayoutInflater to inflate its view hierarchy when needed.  As far as
inflating the view hierarchy goes, they are the same.  They just are
different APIs, so the only interesting different between them is really the
obvious difference in how you use the API.

On Thu, May 19, 2011 at 7:41 AM, Diego Tori

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.


Other Threads

1. suggestion for keyboard

One thing that WinMo did correctly, is that it allowed you to select
an input type (writing, onscreen keyboard, etc) and stick with it.  It
remembered what you were using last.  The new software keyboard (Thank
you!) is great, but it would be better if you didn't have to mess with
toggling as much.

I work out six days a week, and I use the website to
record my progress.  My workouts are logged into fields and then they
graph them for me, it's really a cool website.  Anyway, all of what
I'm inputting when I record my progress is numbers.  Weight, miles,
minutes, reps --- all numbers.  So every time I enter a field, the
software keyboard pops up and it's all letter keys, so I have to
toggle to numbers.  No big deal so far, right?  Well, today, for
example, my workout consisted of 40 fields.  That means I opened the
software keyboard and had to then toggle to number keys 40 times. Even
when I was in one field and then tapped into the one next to it the
keyboard refreshed itself and came back up as letters.  Tap, toggle,
type.  Tap, toggle, type, at least 40 times today in the space of an
hour.  When I had winmo, the first time I toggled to numbers, but
afterwards when I moved into a new field, the keyboard might disappear
for a second and reappear but it would remember that I was on the
number keypad and come back up with that keypad.

I would not suggest adding a row of numbers to the onscreen keyboard.
The keyboard already takes up enough room.

I would just add a checkbox in the keyboard settings that says
"remember keyboard previous state" or "allow sticky toggle" or
something.  Some people might not do as much numerical entry as I do,
but if you want android to be able to handle spreadsheets (google
docs) this is something that will definitely need to be addressed on
the keyboard at some point.  Luckily I have the G1, so the hardware
keyboard is perfectly fine.  But for devices that don't have that
option, the ability to not have the keyboard reset as you move from
field to field would be helpful.

One other thing I noticed, the suggested words section doesn't seem to
know it's own family.  I was typing in my email address and it never
once suggested "gmail" while I typed.

Thank you, thank you, thank you.
You don't know how much I appreciate you guys coming in and giving
both Mac and Microsoft a run for their money.  You guys do great work,
and I tell people all the time "It's not a matter of *IF* Google will
improve or update it's products, it's a matter of *how soon?* "

2. Check Download freeware for you
Download Free WMA to mp3 converter Windows
Nokia Ovi Store Launch Is A Complete Disaster
OpenX Keeps On Growing, Raises $10 Million More
Kindle Notes And Highlights Now Accessible On the
When 1.3 Billion People Are Too Many
Facebook Takes That $200 Million Investment From T
Live Blogging The Facebook Conference Call
Taking Yahoo Meme For A Spin: It A Mediocre Tumb
Now You Can Avoid Euro Disney In Google Earth, Jus
Microsoft Bing Logo Leaked By Way Of Favicon?
The Awesome Potential Of Retweet
It May Not Be Making A TV Show, But Twitter Sure H
Feel The DailyBurn: Gyminee Gets A New Name, Raise
OurParents Launches Free Customized Service To Fin
Contenture Launches. Micropayment-Based Freemium M
Need A Witty pp For ThatPhrase? There An App
7:05 AM TechCrunch Topsy Search Launches: ReTweets
Topsy Search Launches: ReTweets Are The New Curren
Exclusive Video: Mark Zuckerberg And Yuri Milner T
Multiply 4.0: Social Network Photo Sharing Done Ri
Adify Opens Up API To Expand Technology For Ad Net
Berita-Berita Indonesia 27 Maret 2009 | Surya Onli
Indonesia Berita 27 Maret 2009 -
Internet Explorer 8 Tip - Hide Text And Display Ic
12:47 PM Tech Dreams IconFinder Excellent Search
IconFinder Excellent Search Engine To Download H
Meet Your April YouPerform Contest Winners
Download The Unborn (2009) | Movie
Download VA - The Hit List | Music
Download Super Mario Collections 2009 | Games
Download AVG Internet Security v8.5.339
Download Kelly Clarkson - All I Ever Wanted (2009)
A Tribute to Blink-182 VOL 2
A meaningful tribute to fallen soldiers, on Google
Find the right music for your workout with Beatsca
May 26, 2009 Download Squad Embed Flash games on y
Embed Flash games on your site with Heyzap
May 26, 2009 Download Squad Microsoft releases Win
Microsoft releases Windows Vista SP2
May 26, 2009 Download Squad Nokia Ovi mobile app s
May 26, 2009 Download Squad Share files via Twitte
Share files via Twitter with FileTwt
Cross platform digital audio editor Reaper hits 3.
Palm WebOS features previewed thanks to a leaked e
How a New Yorker cover was drawn with a $5 iPhone launches tasks, global folders and custom
Autodesk Dragonfly does easy, web-based home desig
ReminderFeed: add reminders to your RSS reader
6:44 AM Download Squad Coming soon: Google Android
Coming soon: Google Android applications on Ubuntu
US Android users can finally have their Cupcake an
asal mula nama "bekasi"
asa berujung lara
[Lowongan] Senior & Junior Java Software Developer
Galileo Galilei Dihukum Karena Kecerdasannya
Picture, Ternyata Di bawah tanah bagus
Percobaan Nuklir Korea Dilakukan Hari ini
Berkat Game, Matematika Tak Lagi Menakutkan
Tips melindungi mata saat berkomputer
Cepat Terindeks di Search Engine
Merusak website Part I
RuMuS CinTa KauM AdaM ARi MaTa TuRuN Ke HaTi
cUrHaTEh SeLiNgkuH ???
Renungan, Jangan Melihat Ke Belakang

3. SDK 1.5 CPU usage

4. Unbale to opem IM app.

5. Identifying HSDPA usage

6. Receiving Changes to the Phone state

7. G1 calendar sync not working