Hasn't anybody implemented it? I'd really like to use this component in my
app.
Thanks in advance.
On Thursday, October 25, 2012 4:02:51 PM UTC+3, bkadirbeyoglu wrote:
>
> Hi,
>
> I am trying to implement Dave Smith's PagerContainer to show multiple
> pages in my viewpager. I have implemented an on-click listener to display
> the page numbers, but when I click on the left page, "clicked on item 2"
> message is shown (item 0 would be correct). If I click on the middle and
> the right pages, correct messages are displayed, "item 1" and "item 2"
> respectively. I've lalso attached an image to describe the problem. How can
> I fix this? Thanks in advance.
>
> The code snippet is given below:
>
> @Override
> public Object instantiateItem(ViewGroup container, final int
> position) {
> TextView view = new TextView(PagerActivity.this);
> view.setText("Item "+position);
> view.setGravity(Gravity.CENTER);
> view.setBackgroundColor(Color.argb(255, position * 50,
> position * 10, position * 50));
>
>
> view.setOnClickListener(new View.OnClickListener() {
>
> public void onClick(View v) {
>
> Toast.makeText(PagerActivity.this, "clicked on Item " +
> String.valueOf(position), 1000).show();
>
> }
> });
>
> container.addView(view);
> return view;
> }
>
>
> ----------------------------------
>
>
> pager.setOffscreenPageLimit(adapter.getCount());
>
> pager.setPageMargin(15);
>
> pager.setClipChildren(false);
>
>
> ---------------------------------
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en