Understanding android navigation drawer and fragments -
i'm quite new drawer material , have trouble understanding things: need create activity
fragment
on it. different selections on drawer
must replace current fragment
one, drawer
in fragment or 1 activity itself. more drawer
living in fragment
, if not possible create in fragment
. asking cause see when initiating drawer
need fill parent activity. when tried use navigation drawer
template in android studio
didn't had use fragment
checkbox.
there many ways achieve want. think simplest way is:
1) drawerlayout
view should reside in activity (probably base layout).
2) when click on item in draw 2 things happen:
the fragment replaced (you have 1 layout contain fragment , replace fragment in it).
the items inside drawer update (if making list set data , call
notifydatasetchanged()
.
don't forget save state can recover in case activity
recreated.
Comments
Post a Comment