Reputation: 513
I have a list of items that each has their own ArrayList<String>
. When an item is clicked, the ViewPager activity is opened. I want each string to fill up an entire view in ViewPager, so that the user can swipe through each of these strings as pages.
ArrayList<String>
? Upvotes: 1
Views: 2371
Reputation: 15379
You should probably use a ViewPager
. To use it you need to supply a PagerAdapter
. In your subclass of PagerAdapter, just have your instatiateItem
override create a TextView (either programmatically, or by inflating a layout with a TextView) and set the text to the String at the position in the array corresponding to the position
parameter of instantiateItem. Something like this
@Override
public Object instantiateItem (ViewGroup container, int position) {
TextView tv = new TextView(getContext());
tv.setText(mList.get(position));
return tv;
}
Upvotes: 1