android - ViewPager is not showing up on bottomSheetDialog -
viewpager not showing on bottomsheetdialog. here implementation.
public void show(final boxitem boxitem) { bottomsheet = (mcontext).getlayoutinflater().inflate(r.layout.layout_change_size_and_frequency, null); bottomsheetdialog.setcontentview(bottomsheet); bottomsheetdialog.show(); hashmap = boxitem.getfrequencyitemconfighashmap(); initviews(); setupviewpagerandtabs(); } private void setupviewpagerandtabs() { set<string> keyset = hashmap.keyset(); viewpageradapter adapter = new viewpageradapter(((appcompatactivity) mcontext).getsupportfragmentmanager()); (string key : keyset) { adapter.addfragment(searchdetailitemsfragment.getinstance(hash.get(key)), key); } viewpager.setadapter(adapter); tablayout.setupwithviewpager(viewpager); } private void initviews() { tablayout = (tablayout) bottomsheet.findviewbyid(r.id.tabs); viewpager = (viewpager) bottomsheet.findviewbyid(r.id.viewpager); }
fragments not allowed on dialogs. solved problem using bottomsheetdialogfragment allow various things keep fragment's lifecycle.
Comments
Post a Comment