java - ViewPagerIndicator: control tab width or visibility individually -


i have 4 tabs in tabpageindicator , want tabs after 3rd 1 gone completely, i.e. focus corresponding fragments pressing other controls, tabs should not visible in way. tried modifying addtab shown below, not seem help:

private void addtab(int index, charsequence text, int iconresid) {     final tabview tabview = new tabview(getcontext());     tabview.mindex = index;     tabview.setfocusable(true);     tabview.setonclicklistener(mtabclicklistener);     tabview.settext(text);      if (iconresid != 0) {         tabview.setcompounddrawableswithintrinsicbounds(0, iconresid, 0, 0);     }      if (index>3)      {            tabview.setvisibility(view.gone);         mtablayout.addview(tabview, new linearlayout.layoutparams(0,                 0, 0));     } else     mtablayout.addview(tabview, new linearlayout.layoutparams(0,             match_parent, 1)); } 

update: found stupid mistake:

if (index>3)  

should be

if (index>2)  

as tabs numbered 0, not 1.

sorry, plain stupidity - "after 3rd one" not translate

   if (index>3) {..} 

tabs indexed 0, should

   if (index>2) {..} 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -