上一章讲到启动页面,接下来应该说说引导页。很简单,就是利用ViewPager进行横向滑动,装载需要展示的引导页布局即可,如果说要做页面指示器的话,相对麻烦一点。先看看三个布局文件的代码和具体的展示效果吧!
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/bm_img"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="50dp"
android:src="@mipmap/ic_logo"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:textColor="#fff"
android:padding="5dp"
android:textSize="20sp"
android:text="欢迎使用笑话大全(Jokes),首先感谢您选择安装了这款APP,这是一款实时更新段子和小笑话的应用,它能够很好的打发时间,更重要的是它能在您心情低落时博君一笑,让你走出心理阴霾。"
android:layout_below="@+id/bm_img"
android:layout_centerHorizontal="true" />
</RelativeLayout>
这是第一个引导页的布局文件代码,对应的展示效果如下:
接下来是第二个布局文件的代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/viewpager_guide2img"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="50dp"
android:src="@mipmap/ic_guidebm"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:padding="5dp"
android:textColor="#fff"
android:textSize="20sp"
android:text="此应用为本人总结所学知识点的完整实例。因本人技术有限,界面和性能的优化上都存在许多不足,在后续的版本中会陆续改进,望朋