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
Post a Comment