What is the difference between <include> and <ViewStub> tags in android? -
i fresher in android development,and curious know difference between , i've read tutorials, haven't yet found simple example usage.
would happy if provide such example or give pointer one.
<include />
include xml contents in base xml file if whole thing single big file. it's nice way share layout parts between different layouts.
<viewstub />
bit different because not directly included, , loaded when use/need it, i.e. when set visibility "true". nice optimization because have complex layout tons of small views or headers anywhere, , still have activity load fast. once use 1 of views, it'll loaded.
include
it used reuse layout resource
viewstub
it used lazily inflate layout resource
Comments
Post a Comment