Open chhetrirahul opened 6 years ago
I had this problem too, to solve it you need to download the TourGuide lib from here https://github.com/worker8/TourGuide/releases/tag/v1.0.17-SNAPSHOT and integrate it in your app, to be able to modify the lib code. Then, create a new method like this:
public static Point getDefaultResolution(Activity activity) {
Display display = activity.getWindowManager().getDefaultDisplay();
Point size = new Point();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
display.getRealSize(size);
else
display.getSize(size);
return size;
}
It allows to get the "real" resolution of the device, including the soft buttons area if any.
Finally, each time TourGuide lib calls getResources().getDisplayMetrics().widthPixels
or getResources().getDisplayMetrics().heightPixels
, call the method above instead.
Solved! :)
not working,can you show the sample code?
"Can you show the sample code please?" I help you freely, I'm don't owe you anything, so please, be a bit kinder.
I wrote above the method to get the real screen resolution, including the soft buttons area.
What you just have to do is copy/paste this method, and call it each time TourGuide lib calls getResources().getDisplayMetrics().widthPixels
or getResources().getDisplayMetrics().heightPixels
.
This is called in getScreenWidth()
method in TourGuide.java
, and in init(AttributeSet attrs, int defStyle)
method of FrameLayoutWithHole.java
.
got it! Thank you very mach!!!!!!
You're welcome :)
Thank you
Another way to deal with this issue, is to replace the official Gradle dependency of this project, which I had it like this:
implementation('com.github.worker8:tourguide:2.0.0-SNAPSHOT@aar') {
transitive(true)
}
And replace it with the patched version from hieuseesaa:
implementation "com.github.hieuseesaa:tourguide:b00064a"
This way, you'll basically download the dependency from the Git fork of hieuseesaa (to the very commit that deals with this, so if the fork of hieuseesaa changes, it won't affect anything else).
We wouldn't have to do this if the maintainer of this wonderful Android library would accept the pull request from hieuseesaa.
@carlos-mg89 This library has no maintainers. so I recommend you to fix it yourself and create your own fork Then Please visit jitpack.io to release version jitpack is very easy to use
Overlay leaves some space at the bottom in devices with onscreen buttons in navigation bar. It is fine with device with physical button.