Assistance needed Understanding Android fragment addition during onCreate -
i need cleaning information doesn't make sense me, use cases if possible.
what understand:
with fragments in android, understand if plan on replacing them need have container view, preferably framelayout, , add initial fragment container during activities oncreate method. there 1 thing continues not make sense me.
what don't understand , need with:
what rules there regarding where/how container view set up, if there any. android developers site makes container view needs it's own xml layout file, doesn't , have seen examples on here framelayouts nested inside of typical layout files, specific uses , need understand rules of setting container up.
there no rules. need viewgroup
-- position , size want. when add fragment
it, behave if you'd created fragment
's view
manually, , called yourviewgroup.addview(fragmentview)
.
framelayout
typically used because makes container no real behavior (you give size , position , let fragment fill container).
there's absolutely no need make container view own layout file. in fact, if want fragment
take on content view of entire activity
, add fragment
activity
using id android.r.id.content
.
Comments
Post a Comment