![]() WindowManager.LayoutParams params = new WindowManager.LayoutParams( Unless your AndroidManifest.xml contains the SYSTEM_ALERT_WINDOW permission, the code will fail: You can use the code in free or non commercial applications. ![]() You can download the sample application here. To make things easier, I created a special service class, since the code that displays a cursor would probably be a service, running in the background, and accepting cursor position updates. So what we are about to do is have a small view created, make it show a cursor image, and move it around. These windows must not take input focus, or they will interfere with the keyguard. The SDK defines them as: “Window type: system overlay windows, which need to be displayed on top of everything else. The second approach, and the subject of this article, is drawing a cursor using an Android Overlay cursor. We can draw the cursor at the framebuffer level, and while this provides optimum performance, it requires special privileges that regular apps don’t have. For an application developer it is important to have total freedom in shaping the result of his work.Įven if Android OS has been designed without the mouse cursor in mind, there are plenty of situations where a developer needs a cursor on top of other applications installed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |