worker8/TourGuide

Skip option

Opened this issue · 2 comments

It is not an issue, it's my suggestion that, There should be one skip button so that user can skip the tutorial any time instead of going one by one at the last and finish the tutorial.

I agree with @amarsaurabh. How can we add a skip button to allos the user to skip the tutorial at any time?

You can add Skip button or any other ui on overlay, like I added Skip button,

FrameLayout frameLayout = tourGuideHandler.getOverlay();

                if (frameLayout != null) {
                    //set the properties for button
                    Button btnTag = new Button(context);
                    final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

                    params.gravity = Gravity.TOP | Gravity.RIGHT;

                    Rect rectangle = new Rect();
                    Window window = context.getWindow();
                    window.getDecorView().getWindowVisibleDisplayFrame(rectangle);
                    int statusBarHeight = rectangle.top;

                    int marginTop = 10 + statusBarHeight;
                    int marginBottom = 10 + statusBarHeight*2;
                    int marginRight = 10;
                    int marginLeft = 10;

                    params.setMargins(marginLeft, marginTop, marginRight, marginBottom);
                    btnTag.setLayoutParams(params);
                    btnTag.setText("Skip");
                    btnTag.setId((int) System.currentTimeMillis());

                    //add button to the layout
                    frameLayout.addView(btnTag);

                    btnTag.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {

                        }
                    });
                }