PagerAdapter起始位置 [英] PagerAdapter start position

查看:170
本文介绍了PagerAdapter起始位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的例子来impliment我viewPager: <一href="http://$c$c.google.com/p/viewpagerexample/issues/list">http://$c$c.google.com/p/viewpagerexample/issues/list

I'm using the following example to impliment my viewPager: http://code.google.com/p/viewpagerexample/issues/list

这个例子的问题是,我无法弄清楚如何设置我的出发位置,默认的起始位置为0。基本上我wan't要能够控制,如果有在它的左边或可用的视图正确的。

The problem with this example is that I can't figure out how to set my starting position, the default starting position is 0. Basically I wan't to be able to control if there is an available view on its left or the right.

有没有什么办法可以控制中心的查看当前位置?有没有更好的办法做到这一点? 有没有可能让它圆形?

Is there any way to control center's View current position? is there a better way to do it? is it possible to make it circular?

推荐答案

我已经找到一种方法来设置它的位置,它是在课堂外完成的:

I've found a way to set it's position, which is done outside of the class:

 awesomePager = (ViewPager) findViewById(R.id.awesomepager);
 awesomePager.setAdapter(awesomeAdapter);
 awesomePager.setCurrentItem(CurrentPosition);

和它可以通过计算欲适应于它的物品的量的限制

and it can be limited by calculating the amount of items I want to fit in to it

这篇关于PagerAdapter起始位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆