Material Design 风格引导页

本文介绍了如何基于Android L的Material Design设计风格创建引导页,重点在于利用ViewPager和Fragment实现页面滑动时的背景颜色过渡效果。通过添加support libraries,创建引导页Activity和Theme,设置上一页和下一页Button,以及圆点指示器,实现了类似Google Drive引导页的过渡动画。文中还提到了Fragment界面设计和ViewPager的背景色调整,以及监听和按钮点击事件的处理。
摘要由CSDN通过智能技术生成
前言

Material Design 是在 Android L 推出的设计风格,因此本文中的引导页制作也是基于 Android L 进行。我们先看下 Google Drive 的引导页。

Google Drive

可以看出,当进行页面滑动时,背景颜色由前一页过渡到下一页,我们也将要实现类似的效果,使用 ViewPager + Fragment (共3页) 。

创建
  • 添加 support libraries
dependencies {
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    ...
}
  • 新建引导页 Activity (本文 GuideActivity) 及相关 Theme。如
<style name="GuideTheme"
parent="Theme.AppCompat.DayNight.NoActionBar">
    //沉浸状态栏,将状态栏填充
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowTranslucentStatus">true</item>
</style>
  • 底部导航样式

    底部导航

    1.上一页 Button(第一页时隐藏);
    2.圆点指示器;
    3.下一页 Button 及 进入登录界面 Button(默认隐藏)。

  • Activity Layout

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context="com.snow.guidepage.GuideActivity">

    <android.support.v4.view.ViewPager
        android:id="@+id/view_pager"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:overScrollMode="never"
        android:paddingBottom="?attr/actionBarSize"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值