代码贴上来有些不见了 可以参考一下 整个项目放在百度云上解压就可以在ecplice导入即可 https://pan.baidu.com/s/1miG4sh6

yingdaye.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" >

<android.support.v4.view.ViewPager
    android:id="@+id/Viewpagerid"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
</android.support.v4.view.ViewPager>

<LinearLayout
    android:id="@+id/dianjiheid"
    android:layout_width="match_parent"
    android:layout_height="20px"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="100dp"
    android:gravity="center" >

    <ImageView
        android:id="@+id/imageviewid1"
        android:layout_width="20px"
        android:layout_height="match_parent"
        android:layout_marginLeft="10px"
        android:layout_marginRight="10px"
        android:background="#000000" />

    <ImageView
        android:id="@+id/imageviewid2"
        android:layout_width="20px"
        android:layout_height="match_parent"
        android:layout_marginLeft="10px"
        android:layout_marginRight="10px"
        android:background="#000000" />

    <ImageView
        android:id="@+id/imageviewid3"
        android:layout_width="20px"
        android:layout_height="match_parent"
        android:layout_marginLeft="10px"
        android:layout_marginRight="10px"
        android:background="#000000" />

    <ImageView
        android:id="@+id/imageviewid4"
        android:layout_width="20px"
        android:layout_height="match_parent"
        android:layout_marginLeft="10px"
        android:layout_marginRight="10px"
        android:background="#000000" />
</LinearLayout>
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="20px"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="70dp">


<LinearLayout
    android:id="@+id/dianjiheid2"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center" >

    <ImageView
        android:id="@+id/imageviewid12"
        android:layout_width="20px"
        android:layout_height="match_parent"
        android:layout_marginLeft="10px"
        android:layout_marginRight="10px"
        android:background="#000000" />

    <ImageView
        android:id="@+id/imageviewid22"
        android:layout_width="20px"
        android:layout_height="match_parent"
        android:layout_marginLeft="10px"
        android:layout_marginRight="10px"
        android:background="#000000" />

    <ImageView
        android:id="@+id/imageviewid32"
        android:layout_width="20px"
        android:layout_height="match_parent"
        android:layout_marginLeft="10px"
        android:layout_marginRight="10px"
        android:background="#000000" />

    <ImageView
        android:id="@+id/imageviewid42"
        android:layout_width="20px"
        android:layout_height="match_parent"
        android:layout_marginLeft="10px"
        android:layout_marginRight="10px"
        android:background="#000000" />


</LinearLayout>

<ImageView
    android:id="@+id/imageviewid6"
    android:layout_width="20px"
    android:layout_height="20px"
    android:background="#87cefa" />

yingdayetupiang.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/yingdandyetupiang" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" >

<Button
    android:id="@+id/tiaoguoid"
    android:layout_width="100dp"
    android:layout_height="50dp"
    android:layout_gravity="right|top"
    android:layout_marginRight="50dp"
    android:layout_marginTop="50dp"
    android:background="#ffaaaa"
    android:text="跳过"
    android:visibility="gone" />

YingDaYeActivity.java package com.example.yingdaoye;

import java.util.ArrayList; import java.util.List;

import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.util.DisplayMetrics; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout.LayoutParams;

public class YingDaYeActivity extends Activity { private List listarray; // 数据源就要显示的图片 private ViewPager viewpager; private LinearLayout dianjihe; private PagerAdapers adapers; // 自定义适配器

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.yingdaye);
    indateorview(); // 数据,界面初始化
    setviewpager(); // 设置引导实现

}

private int pingkuang(){   //测量当前屏幕的宽度(像素px)
    DisplayMetrics metric = new DisplayMetrics();
     getWindowManager().getDefaultDisplay().getMetrics(metric);
    int width = metric.widthPixels;  // 屏幕宽度(像素)
    return width;  
}

private void indateorview() {

    listarray = new ArrayList<Integer>();
    listarray.add(R.drawable.tu1); // 添加图片   tu1——4根据你自己的图片
    listarray.add(R.drawable.tu2);
    listarray.add(R.drawable.tu3);
    listarray.add(R.drawable.tu4); // 总共四张

    viewpager = (ViewPager) findViewById(R.id.Viewpagerid); // 关联ViewPager引导组件
    dianjihe = (LinearLayout) findViewById(R.id.dianjiheid); // 关联LinearLayout组件,LinearLayout包含四个滑动点

    for (int i = 0; i < dianjihe.getChildCount(); i++) { // getChildCount计算LinearLayout组件里面包含几个组件(滑动点)
        ImageView imageviews = (ImageView) dianjihe.getChildAt(i); // 获取指定滑动点

        if (i == 0) { // 界面打开第一个为红,后三个位黄
            imageviews.setBackgroundColor(Color.RED);

        } else {
            imageviews.setBackgroundColor(Color.YELLOW);
        }

    }
    //下面设置蓝动点初始化左边距
    ImageView ima = (ImageView) findViewById(R.id.imageviewid6);
    LayoutParams redparams = (LayoutParams) ima.getLayoutParams();
    int len =(int)(pingkuang()/2.0f-70);
    redparams.leftMargin = len;
    ima.setLayoutParams(redparams); //
}

private void setviewpager() {
    adapers = new PagerAdapers(this, listarray); // 初始化自定义PagerAdapter适配器
    viewpager.setAdapter(adapers); // ViewPager引导组件设置适配器

    viewpager.setOnPageChangeListener(new OnPageChangeListener() { // ViewPager引导组件设置滑动监听

        // 实现滑动监听需要实现下面三个方法,方法具体作用自己查吧!
        @Override
        public void onPageSelected(int arg0) {  //红色滑动点会根据屏幕滑动一页后,对应跳动滑动点
            // TODO Auto-generated method stub
            for (int i = 0; i < dianjihe.getChildCount(); i++) {
                ImageView imageview = (ImageView) dianjihe.getChildAt(i);
                if (i == arg0) {
                    imageview.setBackgroundColor(Color.RED);
                } else {
                    imageview.setBackgroundColor(Color.YELLOW);

                }

            }
        }
          //(pingkuang()/2.0f-70)等于第一个滑动点的左边距
         //40 * positionOffset + position * 40 等于已经滑动过的页数加当前页滑动的百分比距离
        @Override
        public void onPageScrolled(int position, float positionOffset, int arg2) {  //蓝色滑动点会根据屏幕滑动多少,对应动态滑动
            ImageView ima = (ImageView) findViewById(R.id.imageviewid6);
            LayoutParams redparams = (LayoutParams) ima.getLayoutParams();
            int len = (int) (40 * positionOffset + position * 40 + (pingkuang()/2.0f-70));
            redparams.leftMargin = len;
            ima.setLayoutParams(redparams);

        }

        @Override
        public void onPageScrollStateChanged(int arg0) {
            // TODO Auto-generated method stub
        }
    });

}

}

PagerAdapers.java package com.example.yingdaoye;

import java.util.List;

import android.content.Context; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.LinearLayout;

/** * 自定义适配器 */

class PagerAdapers extends PagerAdapter { private LayoutInflater mInflater; private List mlistarray;

/**
 * 构造函数
 * 
 * @param mContext
 *            上下文
 * @param mList
 *            数据源
 */

PagerAdapers(Context mContext, List<Integer> mList) {
    this.mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    this.mlistarray = mList;
}

/**
 * 数据源长度
 */
@Override
public int getCount() {
    return mlistarray.size();
}

/**
 * 销毁视图
 */
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    ((ViewPager) container).removeView((View) object);
}

@Override
public int getItemPosition(Object object) {
    return POSITION_NONE;
}

/**
 * 自定义视图(这个是关键 适配器根据ViewPager的操作,把instantiateItem()返回的view显示ViewPager上)
 * View是用另一张布局
 */
@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = (View) mInflater.inflate(R.layout.yingdayetupiang, container, false);

    LinearLayout lineas = (LinearLayout) view.findViewById(R.id.yingdandyetupiang);

    lineas.setBackgroundResource(mlistarray.get(position));

    if(position==3){    //最后一张时,设置按钮为可见
        Button button = (Button)view.findViewById(R.id.tiaoguoid);
        button.setVisibility(View.VISIBLE);  
    }


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

    return view;
}

/**
 * 判断两个对象是否相同
 */
@Override
public boolean isViewFromObject(View arg0, Object arg1) {
    return arg0.equals((View) arg1);
}

}