android - Tab Swipe View in landscape, plain layout in portrait -
my app supposed show plain linearlayout listview , textview when in portrait, swipeview 3 tabs when in landscape. layout changed whenever orientation of phone changed.
i you'd have 2 layout files portrait , lanndscape feel won't sufficient in case. after tab , swipe functionality requires more xml file. while looking solutions problem suggested starting new activity in onconfigurationchanged() method, @ same time stated bad practice leading sorts of problems.
now thought adding whole lot of if-else statements tagactivity.java checking current orientation , spawning whatever needed. way it? possible have multiple oncreate() methods, 1 each orientation?
any input appreciated!
the tutorial used implement tabactivity 1 androidhive: http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/
i did similar in recent project. ended using view pager pagerslidingtabstrip (https://github.com/astuetz/pagerslidingtabstrip/issues/5). in portrait show 1 fragment in view pager , hide tabs, , in landscape populate out view pager , tabs. not sure if works in particular situation (it seems would), food thought.
Comments
Post a Comment