Code example for ViewPager

Methods: addViewaddViewsetFillViewport

2
		return arrDays.length;
	} 
	 
	@Override 
    public Object instantiateItem(View collection, int position) {
        ScrollView sc = new ScrollView(cxt);
        //sc.set' 
        //sc.generateLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); 
        sc.setFillViewport(true);
        TextView tv = new TextView(cxt);
        tv.setGravity(Gravity.CENTER);
        tv.setTextColor(Color.BLACK);
        //tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); 
        tv.setText(Html.fromHtml(cardapio.getDay(position)));
        tv.setPadding(5,5,5,5);
        sc.addView(tv);
        tv.setId(ids[position]);
        ((ViewPager) collection).addView(sc);
        return sc;
    } 
	 
	@Override 
    public void destroyItem(View collection, int position, Object view) {