Android swipe and tabs ui - what is "best practice" and up to date? -
i have used in past "android actionbar fragmentpageradapter , viewpager" seems little out of date - there newer, more advanced/better guideline/technique stuff ?
android 4.4
for example:
private viewpager viewpager; private tabspageradapter madapter; private actionbar actionbar;
and tabspageradapter class:
public class tabspageradapter extends fragmentpageradapter { frontendcontroller context; wearlistfragment wearlistfragment; mobilelistfragment mobilelistfragment; favouritelistfragment favouritelistfragment; advancedcontrolfragment advancedcontrolfragment; controlfragment controlfragment; setupfragment setupfragment; statusfragment statusfragment; public tabspageradapter(fragmentmanager fm,frontendcontroller context) { super(fm); this.context =context; } // "setup", "advanced","favourite","status","control", "mobile", "wear" @override public fragment getitem(int index) { switch (index) { case 0: //setup setupfragment = new setupfragment(); setupfragment.setcontext(context); return setupfragment; case 1: advancedcontrolfragment = new advancedcontrolfragment(); advancedcontrolfragment.setcontext(context); return advancedcontrolfragment; case 2: favouritelistfragment= new favouritelistfragment(); favouritelistfragment.setcontext(context,this); return favouritelistfragment; case 3: statusfragment = new statusfragment(); statusfragment.setcontext(context); return statusfragment; case 4: controlfragment = new controlfragment(); controlfragment.setcontext(context); return controlfragment; case 5: mobilelistfragment = new mobilelistfragment(); mobilelistfragment.setcontext(context); return mobilelistfragment; case 6: wearlistfragment = new wearlistfragment(); wearlistfragment.setcontext(context); return wearlistfragment; } return null; } @override public int getcount() { // item count - equal number of tabs return 7; } public wearlistfragment getwearlistfragment() { return wearlistfragment; } public mobilelistfragment getmobilelistfragment() { return mobilelistfragment; } public favouritelistfragment getfavouritelistfragment() { return favouritelistfragment; } }
you have lot of posibilities:
default android tabs , viewpager:
plugins (recommended):
most famous:
implement guide: https://stackoverflow.com/questions/26178838/pagerslidingtabstrip implement-guide
others:
Comments
Post a Comment