ViewPageIndicator.CirclePageIndicator / TitlePageIndicator不可见

时间:2013-11-21 05:55:46

标签: android

我一直在努力使用ViewPageIndicator.CirclePageIndicator / TitlePageIndicator。

在删除初始hickup后,我已成功将ViewPageIndicator集成到我的项目中。但最后当我跑步时,我看不到任何底部或任何地方。是否有可能隐藏在一些观点背后?以下是代码段。

XML文件。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <android.support.v4.view.ViewPager
        android:id="@+id/questionpager"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
    </android.support.v4.view.ViewPager>

    <com.viewpagerindicator.CirclePageIndicator
        android:id="@+id/circlequestionpager"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:background="@color/RED"/>

</LinearLayout>

代码。

        mAdapter = new MyAdapter(getSupportFragmentManager());

        mPager = (ViewPager) findViewById(R.id.questionpager);
        mPager.setAdapter(mAdapter);

        //Bind the title indicator to the adapter
        CirclePageIndicator circlequestionpager = (CirclePageIndicator)findViewById(R.id.circlequestionpager);
        circlequestionpager.setViewPager(mPager);

        if (fragments != null && fragments.size() > 0) {
            currentPage = (SingleQuestionView) fragments.get(0); 
            currentPage.startTimer();
        }
        ViewPager.SimpleOnPageChangeListener pageChangeListener = new ViewPager.SimpleOnPageChangeListener() {
            @Override
            public void onPageSelected(int position) {
                super.onPageSelected(position);

                if (currentPage != null) {
                    currentPage.stopTimer();
                }

                currentPage = (SingleQuestionView) fragments.get(position);
                currentPage.startTimer();

            }
        };

        /** Setting the pageChange listner to the viewPager */
        //mPager.setOnPageChangeListener(pageChangeListener);
        circlequestionpager.setOnPageChangeListener(pageChangeListener);

请提出可能存在的问题

0 个答案:

没有答案