Does anyone have any idea how this can be implemented?
Some examples:
- https://play.google.com/store/apps/details?id=gpc.myweb.hinet.net.PopupVideo
- https://play.google.com/store/apps/details?id=com.milone.floatwidget
Any idea? Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That is done using an overlay on top the existing activity regardless. You can find the source found here on my github to demonstrate the proof of concept that was on android’s stackexchange.com question in which someone who suffered from a disability and could not swipe the screen to scroll and was looking for a way to do this conveniently, in which I cobbled together the code to show ‘Page Up/Page Down’ with minimum movement, just by tapping on the text (really, its a button) which overlaid on top of a activity. But due to the way Android and security worked, the scrolling event could not be injected into the currently running activity.
The way it works is this, from the
onCreateactivity there’s thisThe flag that is needed is
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAYandWindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH.The onus is to ensure that the touch is being handled which means watching out when the touch event ‘hits’ on a area and to act accordingly. By “listening” in on the View’s
onTouchevent, that is:For example, imagine a button within that
myviewlayout, so using a button widget,Now we need to determine the ‘collision’ of the boundaries of the touch, which happens inside the
onTouchhandler:This brief summary explains how to do such a thing as an overlay on-top of any activity.
Just to make sure, that the code gets debugged and does not interfere in any shape or form with any activity shown. For example, what happens if the activity is in fact a OpenGL game, what do you do?
That is to illustrate what needs to be watched out for.