android - How to alternate between fragment containers easily? -
i've got problem i'm having problems solving. app has 2 types of fragments. when app starts, fragment main menu added framelayout
use fragment container. fragment takes entire screen. then, when choose 1 of items in menu, corresponding fragment should loaded container, replacing menu. however, fragment must take 1/4 of screen left, , space outside used other fragment.
i thinking making 3 framelayouts
, 1 left side, 1 right , 1 entire screen, going have problems fragment transactions, since have keep tabs on fragments , remove them hand.
basically need way change whether fragments loaded container takes full screen, or container takes part of screen. tons of trail , error , code, bet there easy way in android missed.
instead of trying dynamically load these fragments various containers, suggest having 2 different activities
.
it sounds main menu fragment ever appear on own in full screen. so, make full activity
(let's call mainmenuactivity
).
the second activity have 2 framelayout
s it's contents, 1 taking 1/4 of screen , other taking remaining 3/4. load second activity upon choosing main menu option , populate fragments in oncreate()
of second activity.
hitting button second activity return user mainmenuactivity
.
Comments
Post a Comment