android - Header logo and header background image disappear on fragment in florent37/MaterialViewPager Library -


i using florent37/materialviewpager library https://github.com/florent37/materialviewpager implement viewpager. have 3 tab app , category , fav. problem header background disappeared in fragement. while when using in activity working. when fragement loaded showing no header color or background when scroll start showing header color doesn't loading background image url.

my adpater class this

public class myfragmentadapter extends fragmentstatepageradapter {      public static int pos = 0;     public static int left_page = 0;     public static int centered_page = 1;     public static int right_page =2;      private list<fragment> myfragments;     private context context;     int oldposition = -1;     materialviewpager materialviewpager;     public myfragmentadapter(context context, fragmentmanager fm,     list<fragment> myfrags, materialviewpager materialviewpager) {         super(fm);          this.myfragments = myfrags;          this.context = context;          this.materialviewpager = materialviewpager;      }       public void updatedata(){         notifydatasetchanged();      }      @override     public fragment getitem(int position) {         return myfragments.get(position);       }      @override     public int getitemposition(object object) {           return position_none;      }       @override      public int getcount() {           return myfragments.size();      }         @override       public charsequence getpagetitle(int position) {          setpos(position);           string pagetitle = "";           switch(pos)          {              case 0:                  pagetitle =    context.getresources().getstring(r.string.view_pager_apps);                  break;              case 1:                  pagetitle =   context.getresources().getstring(r.string.view_pager_category);                  break;              case 2:                  pagetitle =     context.getresources().getstring(r.string.view_pager_fav);                   break;           }          return pagetitle;       }       @override      public void setprimaryitem(viewgroup container, int position,   object object) {         super.setprimaryitem(container, position, object);          //only if position changed           if(position == oldposition)               return;           oldposition = position;            int color = 0;          string imageurl = "";           switch (oldposition){              case 0:                  imageurl = "http://cdn1.tnwcdn.com/wp-    content/blogs.dir/1/files/2014/06/wallpaper_51.jpg";                  color =           context.getresources().getcolor(r.color.blue);                      break;              case 1:                  imageurl =   "https://fs01.androidpit.info/a/63/0e/android-l-wallpapers-630ea6-  h900.jpg";                 color =   context.getresources().getcolor(r.color.green);                  break;    case 2:                   imageurl = "http://www.droid-life.com/wp-    content/uploads/2014/10/lollipop-wallpapers10.jpg";        color = context.getresources().getcolor(r.color.cyan);                   break;               case 3:                   imageurl = "http://www.tothemobile.com/wp-     content/uploads/2014/07/original.jpg";                 color = context.getresources().getcolor(r.color.red);                 break;          }            final int fadeduration = 400;           //change header's color , image               materialviewpager.setimageurl(imageurl,fadeduration);                materialviewpager.setcolor(color,fadeduration);       }       public static int getpos() {         return pos;      }       public static void setpos(int pos) {          myfragmentadapter.pos = pos;     }   } 

the below line not doing there work . materialviewpager.setimageurl(imageurl,fadeduration);

please me figure out on problem. cause me pain few days. :)


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -