简体   繁体   中英

How can i add and remove multiple pages in horizontal viewpager for android?

here i have one application in which i used viewpager. i want to add and remove views from pageadapter dynamically with programming.

now i add only 4 views static to this PagerAdapter.

private ArrayList<LinearLayout> views;

public MyPagerAdapter(Context context) 
{
      views = new ArrayList<LinearLayout>();
      views.add(new ListView1Page(context));            
      views.add(new TextViewPage(context));
      views.add(new ListView2Page(context));
      views.add(new ButtonPage(context));
}

please help if any body have idea. give some links which can be helpful to me

If you aren't using a fragment adapter, my solution might work for you. Please see my post .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM