全国免费服务热线:

18982081108
✕

成都网站维护公司,网站安全维护,网站SEO优化,网站内容运营

Android控件ViewPager实现带有动画的引导页-创新互联

ViewPager实现带有动画的引导页,供大家参考,具体内容如下

腾冲网站建设公司创新互联建站,腾冲网站设计制作,有大型网站制作公司丰富经验。已为腾冲上1000+提供企业网站建设服务。企业网站搭建\外贸营销网站建设要多少钱,请找那个售后服务好的腾冲做网站的公司定做!

好了,又到我们学习基础控件的时候了,其实引导页很简单,就是五张图片而已


一、ViewPager实现传统的引导页

传统的ViewPager实现引导页和ListView是一样道理的,只是把ListView的Item换成图片,把BaseAdapter换成PagerAdapter,我们先来看下传统引导页的效果图

步骤一:编写xml文件

既然用到的是ViewPager,那么xml文件就必须要有ViewPager,细心的你,可能会发现最后一页还有个按钮的出现,没错,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/vp_guide"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

  <Button
    android:id="@+id/bt_main"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerInParent="true"
    android:layout_marginBottom="50dp"
    android:background="@color/colorPrimary"
    android:padding="6dp"
    android:text="立即开启"
    android:textColor="#fff"
    android:textSize="16dp"
    android:visibility="gone" />
</RelativeLayout>