引导页???这是多少人写过的啊,还写,猪吗?
相信很多小伙伴就已经火大了。
其实呢,主要是我进入职场的头一个月基本上就全泡在了引导页上,遇见过各种奇葩心塞的bug
所以在此,想写一系列关于此类的博文
基本路线是:先从ViewPager静态引导页讲起,然后是ViewPager静态页的翻页动画,ViewPager简单动画引导页,SurfaceView复杂型动画引导页
废话不多说,一步步来。先来看看guide_layout.xml文件,这个是引导页的显示页
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<android.support.v4.view.ViewPager
android:id="@+id/guide_view_group"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</android.support.v4.view.ViewPager>
</LinearLayout>
里面就是一个ViewPager,如果没有v4的包,需要自己动态添加以下,这里就不介绍怎么添加v4包了
然后看看引导页的子页,就是滑动的每一页的布局文件,guide_item_view.xml,个人比较懒所以会对这个布局进行复用,形成4个子页。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientatio