Sunday, October 9, 2011

[android-developers] Problem with PagerAdapter using various Views

I used this tutorial to make a little sample app with the PagerAdapter
to swipe through views smoothly.
http://code.google.com/p/viewpagerexample/source/browse/trunk/AwesomePager/src/com/geekyouup/paug/awesomepager/AwesomePagerActivity.java

But the problem there is that they only use one TextView to swipe
through. What I wanted to do is using three different views through
which the user can slide smoothly. However, I could not figure out how
I have to alter the example code mentioned above. It would be perfect
if I even could use (three different) layout xml files for that but
it's also ok if I have to build the views in the code.

Especially this code part is kind of unclear to me and how I have to
alter it.

public Object instantiateItem(View collection, int position) {
TextView tv = new TextView(cxt);
tv.setText("Bonjour PAUG " + position);
tv.setTextColor(Color.WHITE);
tv.setTextSize(30);

((ViewPager) collection).addView(tv, 0);

return tv;
}

Any help is greatly appreciated.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate