Android Fragment what container is it in onCreateView() method -


i wonder container parameter in oncreateview(), cause when inflate view container make me wonder viewgroup this,is viewgroup activity add fragment ? if true why need attach in inflate method cause think add fragment viewgroup of activity in activity's xml anyway.

public view oncreateview(layoutinflater inflater, @nullable viewgroup container, bundle savedinstancestate) {      view view = inflater.inflate(r.layout.fragment_top,container,true);     return view; } 

the inflate() method takes 3 arguments:

  • the resource id of layout want inflate.

  • the viewgroup parent of inflated layout. passing container important in order system apply layout parameters root view of inflated layout, specified parent view in it's going.

  • a boolean indicating whether inflated layout should attached viewgroup (the second parameter) during inflation.

for more refer here


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -