美文网首页
AppIntro 引导页库

AppIntro 引导页库

作者: 北漂攻城狮的泪 | 来源:发表于2017-06-13 17:55 被阅读0次

    、Build中配置环境

    1、allprojects {

    repositories {

    maven { url 'https://jitpack.io' }

    }

    }

    2、dependencies {

    compile 'com.github.apl-devs:appintro:v4.2.0'

    }

    AppIntro2代码应用

    public class MainActivity extends AppIntro2{

    @Override

    public void init(@Nullable Bundle savedInstanceState) {

    super.init(savedInstanceState);

    //添加Fragment

    addSlide(new FristFragment());

    addSlide(new SecondsFragment());

    addSlide(new ThirdsFragment());

    }

    /**

    * 跳过动画

    * @param currentFragment

    */

    @Override

    public void onSkipPressed(Fragment currentFragment) {

    super.onSkipPressed(currentFragment);

    Toast.makeText(this, "跳过引导页", Toast.LENGTH_SHORT).show();

    }

    /**

    * 动画完成

    */

    @Override

    public void onDonePressed() {

    super.onDonePressed();

    Toast.makeText(this, "动画完成", Toast.LENGTH_SHORT).show();

    }

    }

    注意 :

    不要重写onCreate,只用 init 方法就可以了。onCreate的实现已经在AppIntro或AppIntro2中了。

    需要重写onSkipPressed(如果继承的是AppIntro2,则不需要)、onDonePressed()俩个方法。当用户点击"skip"按钮时,触发onSkipPressed,表示跳过引导页,这里你可以实现Activity的跳转。

    当用户切换到了最后一个Slide时,会出现“done”按钮,点击后会触发onDonePressed,表示引导页完毕,这里你可以实现Activity的跳转。

    相关文章

      网友评论

          本文标题:AppIntro 引导页库

          本文链接:https://www.haomeiwen.com/subject/ixfjqxtx.html