android - onFinishInflate() never gets called -


who/what calls onfinishinflate()? no matter how inflate layout files (in code) method never seems triggered. can give me example or tell me when onfinishinflate() called?

view.onfinishinflate() called after view (and children) inflated xml. specifically, during call layoutinflater.inflate(...) onfinishinflate() called. inflation performed recursively, starting root. view containing children may need know when children have finished being inflated. 1 of main uses of callback viewgroups perform special actions once children ready.

let's assume had subclass of view called customview, , not internally inflate layouts itself. if had customview somewhere in layout, i.e. :

... <com.company.customview     android:layout_width="wrap_content"     android:layout_height="wrap_content" /> ... 

you should see callback onfinishinflate() once has been inflated. if in main layout of activity, can consider being after activity.setcontentview(int) called. internally, call layoutinflater.inflate(...).

alternatively, if created instance of customview with:

... new customview(context); ... 

...you not call onfinishinflate(). instantiating in way naturally mean has no children , hence not have wait them instantiated in recursive fashion, in xml inflation.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -