适配器android系统中圈页面指示符适配器、指示、页面、系统

由网友(故巷笑别)分享简介:我试图用圈页面指示,允许用户通过翻转在屏幕上查看多个页面。I am trying to use Circle page indicator to allow users view multiple pages by flipping over the screen.每个页面有视图单独的XML文件,每个页面都有其绑定...

我试图用圈页面指示,允许用户通过翻转在屏幕上查看多个页面。

I am trying to use Circle page indicator to allow users view multiple pages by flipping over the screen.

每个页面有视图单独的XML文件,每个页面都有其绑定到活动Java方法的按钮。我想知道如何初始化在活动的多个页面所有按钮。因为在那一刻,我只能初始化按钮的意见的​​第一页。我无法初始化第二和第三页的按钮。有谁知道如何实现这一目标。我已经放置在单个活动的所有按钮完成所有作业。

Each page has separate XML file for the view and each page has a button which is bind to a java method in the Activity. I would like to know how to initialize all the buttons in the Activity for multiple pages. Because at the moment, I can only initialize the button for the first page of the views. I cannot initialize the button for second and third page. Does anyone know how to achieve this. I have placed all the jobs to be done for all the buttons in a single activity.

我目前正在使用该指标: http://viewpagerindicator.com/

I am currently using this indicator : http://viewpagerindicator.com/

下面是我的适配器圆页面指示:

Here is my adapter for the circle page indicator:

 @Override
public Object instantiateItem(View collection, int position) {

    inflater = (LayoutInflater) collection.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    int resid = 0;
    //View v = null;// inflater.inflate( R.layout.gaugescreen, (ViewPager)collection, false );
    switch( position )
    {
        case 0:
            resid = R.layout.gaugescreen;
            break;
        case 1:
            resid= R.layout.liveworkoutstatisticsscreen;
            break;
         case 2:
             resid = R.layout.mapscreen;
             break;
        default:
            resid = R.layout.gaugescreen;
            break;


    }


        View view = inflater.inflate(resid, null);

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

        return view;
}

有谁知道如何实现这一目标?

Does anyone know how to achieve this?

感谢所有帮助提前

推荐答案

与适应戏外页数限制 setOffscreenPageLimit 让您的其他网页也被实例化。

Adapt the off screen page limit with setOffscreenPageLimit so that your other pages also get instantiated.

阅读全文

相关推荐

最新文章