In my opinion, the best practice in this case is to bind the view [s] to the group of views in the adapter. In your adapter, you must create a linear layout and add as many children as you want.
public Object instantiateItem(ViewGroup container, int position) { LinearLayout ll = new LinearLayout(context); LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(0,MATCH_PART); param.weight = 1.0f; for (int i; i < getChildrenInPage() ; i++) { MyView myView = View.inflate(context, R.layout.my_layout, null) myView.bind(getDataForPosition(getChildrenInPage()*position + i)) ll.add(myView, params)); } }
source share