适配器android系统中圈页面指示符 [英] Adapter for circle page indicator in android

查看:120
本文介绍了适配器android系统中圈页面指示符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

感谢所有帮助提前

推荐答案

与适应戏外页数限制<一个href=\"http://developer.android.com/reference/android/support/v4/view/ViewPager.html#setOffscreenPageLimit%28int%29\"相对=nofollow> setOffscreenPageLimit 让您的其他网页也被实例化。

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

这篇关于适配器android系统中圈页面指示符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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