《笑话大全》APP代码详解2

本文详细讲解了《笑话大全》APP中引导页的实现,通过ViewPager实现页面的横向滑动,以及如何创建简单的页面指示器。引导页包含三个布局文件,每个布局展示效果良好,代码易于理解。页面指示器逻辑清晰,根据页面数量设置相应数量的灰色小圆点,用红色小圆点指示当前页面位置。
摘要由CSDN通过智能技术生成

上一章讲到启动页面,接下来应该说说引导页。很简单,就是利用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="此应用为本人总结所学知识点的完整实例。因本人技术有限,界面和性能的优化上都存在许多不足,在后续的版本中会陆续改进,望朋
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值