[英]Can I use onclick Javascript in Webview in Android to determine X and Y?
I have made a game in Javascript that I want to make into an Android app.. So obviously using a webView.. 我已经用Javascript开发了一款游戏,想要制作成Android应用程序。
I have a function in Javascript that says if you click on the left hand side of the page, the box will move left - if right it will move right etc. 我在Javascript中有一个函数,它说如果您单击页面的左侧,则该框将向左移动-如果向右,则将向右移动等。
My question is if on my Android phone I click on a specific area of the webView, will it be the same as if I click from a computer? 我的问题是,如果我在Android手机上单击了webView的特定区域,是否与从计算机上单击相同?
The reason I am asking rather than showing what I have done, is that I don't want to implement it into Eclipse to find the idea was redundant. 我之所以问而不是展示自己的工作,是因为我不想在Eclipse中实现它以发现这个想法是多余的。
A WebView
is like a browser window. WebView
就像浏览器窗口。
So open your page into the android browser and test, if it works as you wish there, it will most likely work about as good in the WebView
. 因此,将您的页面打开到android浏览器中并进行测试,如果它在您希望的地方能正常工作,则很有可能在
WebView
也能正常工作。
Don't forget to enable JavaScript for the WebView
: 不要忘记为
WebView
启用JavaScript :
webview.getSettings().setJavaScriptEnabled(true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.