JakeWharton / ViewPagerIndicator

Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.
http://viewpagerindicator.com
10.13k stars 4.01k forks source link

ViewPager remove. #116

Closed tigr240172 closed 12 years ago

tigr240172 commented 12 years ago

Hello I have a problem. I draw the View, and then remove it and then re-draw, but the data is not updated within the ViewPager, ViewPager remains the same which was from the beginning! My View:

public View Page(){
        LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                View view = new View(this);
                view = inflater.inflate(R.layout.main_tab_layout,null);
                TabPageIndicator tabIndicator = (TabPageIndicator)view.findViewById(R.id.indicator);

                ViewPager pager = (ViewPager)view.findViewById(R.id.pager);
                pager.setAdapter(new CustomFragmentAdapter(getSupportFragmentManager()));

                tabIndicator.setViewPager(pager);
                tabIndicator.notifyDataSetChanged();
        return view;
    }   

Draw View:

    linearlayout.addView(Page(), new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));

Re-draw View:

  linearlayout.removeAllViews();
  linearlayout.addView(Page(), new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));

In what may be the problem?

JakeWharton commented 12 years ago

ViewPager is part of the support library and not ViewPagerIndicator (this library). If you have issues with ViewPager please ask on StackOverflow, the android developer mailing list, or file a bug on the android issue tracker.