android - How to set Empty View for FragmentActivity? -
i want set empty view / show text in middle of viewpager
when there no screens on fragmentactivity. use getcount()
mpageradapter , add fragment layout empty string seems overkill.
i'd know if there better option. think setemptyview()
made cases haven't been able implement it. want show string hint of how add screens viewpager
users.
how can done?
this i'm doing now:
@override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mpager = (viewpager) findviewbyid(r.id.pager); mpageradapter = new pageradapter(getsupportfragmentmanager()); //... if(mpageradapter.getcount() == 0) { setcontentview(r.layout.fragment_screen_empty); }
my current implementation:
@override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mpager = (viewpager) findviewbyid(r.id.pager); mpageradapter = new pageradapter(getsupportfragmentmanager()); //... if(mpageradapter.getcount() == 0) { setcontentview(r.layout.fragment_screen_empty); }
Comments
Post a Comment