erkutaras / ShowcaseView

ShowcaseView library for Android
Apache License 2.0
231 stars 41 forks source link

Buttons of showcase are appearing outside of display #31

Closed travis575757 closed 4 years ago

travis575757 commented 4 years ago

I tried making a sequence of showcase appearances on a view i was making but after the first showcase no button shows up. When I try removing the first showcase the button shows up but part of it is off screen.

Here is an image of a showcase which is done on the top left rectangle after a showcase was done on the bottom left button. image

What my calls look like

        builder.context(activityRule.getActivity())
                .key("KEY")
                .developerMode(true)
                .view(activityRule.getActivity().findViewById(R.id.button_dashboard_view_init))
                .descriptionImageRes(R.mipmap.ic_launcher)
                .descriptionTitle("First button")
                .descriptionText("Click here to do stuff.")
                .buttonText("Done")
                .buttonVisibility(true)
                .cancelButtonVisibility(true)
                .cancelButtonColor(Color.WHITE)
                .add()                                              //add first showcase
                .view(activityRule.getActivity().findViewById(R.id.linearlayout_dashboard_info))  
                .descriptionTitle("Your Progress")
                .descriptionText("Here is your progress so far")
                .buttonText("Done")
                .buttonVisibility(true)
                .cancelButtonVisibility(true)
                .cancelButtonColor(Color.WHITE)
                .add()                                             //add showcase shown in image
                .build()
                .show();

Note that I'm doing this with Expresso and am just passing an activity rule as the activity

travis575757 commented 4 years ago

It seems like setting negative margins helps this issue a bit although I wouldn't consider it fixed.

travis575757 commented 4 years ago

I forked the project and added two function, useGravity and setGravity to enable gravity and using a gravity argument to position the description relative to the showcase target (ex Gravity.START would place the description box and button to the left of the item being targeted). https://github.com/travis575757/ShowcaseView