当前位置: 移动技术网 > IT编程>开发语言>Java > Android 引导页面NewbieGuide的使用

Android 引导页面NewbieGuide的使用

2020年10月09日  | 移动技术网IT编程  | 我要评论
Android 引导页面NewbieGuide的使用做开发很多的时候都会用到引导页面,今天记录一个比较好用的引导页面NewbieGuide的使用,自己公司的项目中也用到了,在这里面做下记录。上图导入依赖implementation 'com.github.huburt-Hu:NewbieGuide:v2.4.0’给一个github的地址接下来就是简单的使用我上面面的例子来说。private void initGuideView() { Animation enterAnim

Android 引导页面NewbieGuide的使用

做开发很多的时候都会用到引导页面,今天记录一个比较好用的引导页面NewbieGuide的使用,自己公司的项目中也用到了,在这里面做下记录。

上图
在这里插入图片描述
导入依赖
implementation 'com.github.huburt-Hu:NewbieGuide:v2.4.0’
给一个github的地址
接下来就是简单的使用我上面面的例子来说。

private void initGuideView() {

        Animation enterAnimation = new AlphaAnimation(0f, 1f);
        enterAnimation.setDuration(600);
        enterAnimation.setFillAfter(true);

        Animation exitAnimation = new AlphaAnimation(1f, 0f);
        exitAnimation.setDuration(600);
        exitAnimation.setFillAfter(true);



        NewbieGuide.with((Activity) context)
                .setLabel("one")
                .addGuidePage(GuidePage.newInstance()
                        .setLayoutRes(R.layout.wbf_test_guide, R.id.sss)  //自定义的布局
                        .setEverywhereCancelable(false)//是否点击任意位置消失引导页,默认true
                        .setBackgroundColor(0xd8000000)  // 设置背景颜色
                        .addHighLight(sss, HighLight.Shape.ROUND_RECTANGLE, 0, 20, null)
            //(高亮的控件,高亮的形状这个是方形,圆角的大小,高亮相对view的padding,相对于高亮的引导布局)
                        .setEnterAnimation(enterAnimation)  //设置动画
                        .setExitAnimation(exitAnimation)
                )
                .setOnGuideChangedListener(new OnGuideChangedListener() {
                    @Override
                    public void onShowed(Controller controller) {
                        //显示的监听
                    }

                    @Override
                    public void onRemoved(Controller controller) {
                        //消失的监听
                    }
                })
                .addGuidePage(GuidePage.newInstance()
                        .setLayoutRes(R.layout.wbf_test_guide_two, R.id.guideone)
                        .setEverywhereCancelable(false)
                        .setBackgroundColor(0xd8000000)
                        .addHighLight(guideone, HighLight.Shape.ROUND_RECTANGLE, 50, 35, null)
                        .setEnterAnimation(enterAnimation)
                        .setExitAnimation(exitAnimation)

                )
                .setOnPageChangedListener(new OnPageChangedListener() {
                    @Override
                    public void onPageChanged(int page) {
                        //这个是页数的监听
                    }
                })
                .addGuidePage(GuidePage.newInstance()
                        .setLayoutRes(R.layout.wbf_test_guide_three, R.id.guidetwo)
                        .setEverywhereCancelable(false)
                        .setBackgroundColor(0xd8000000)
                        .addHighLight(guidetwo, HighLight.Shape.CIRCLE, 50, 35, null)
                        .setEnterAnimation(enterAnimation)
                        .setExitAnimation(exitAnimation)

                )
                .setOnGuideChangedListener(new OnGuideChangedListener() {
                    @Override
                    public void onShowed(Controller controller) {
                    }

                    @Override
                    public void onRemoved(Controller controller) {

                    }
                })
                //true 新手引导总是显示 false 只显示一次
                .alwaysShow(true)
                .show();
    }

基本上就没有什么了。。。用法很简单
给上一个我代码的链接

本文地址:https://blog.csdn.net/qq_36510659/article/details/108974264

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网