繁体   English   中英

Android Emulator UI不响应输入

[英]Android Emulator UI doesn't respond to input

我刚刚在OSX(10.7.4)上安装了Android SDK(版本20.0.3),因为我想运行Android Emulator只是为了使用Android浏览器测试基于Web的移动应用程序。

我下载了SDK,运行了软件包更新管理器等,然后通过GUI为2.2设置了Android虚拟设备,我可以成功启动仿真器,但是它似乎根本不响应任何输入。 我单击UI触摸屏或键盘/主页/菜单按钮等,Android模拟器只是不响应。 我什至无法打开浏览器或执行任何操作。 谁能说出问题所在?

任何帮助,将不胜感激。

您是否尝试过包括Zepto.js而不是标准Javascript库而不是普通的Jquery.js文件?

响应速度更快,因为它是较轻的程序包,可在慢速的Android模拟器上发光。

为了测试您的点击事件并加快点击响应,请包含来自fwebdev的fastclick.js

如果两者都不起作用,请尝试“海豚浏览器”: https : //play.google.com/store/apps/details? id = mobi.mgeek.TunnyBrowser &hl= zh- CN

https://gist.github.com/2168307

//======================================================== FASTCLICK
function FastButton(element, handler) {
    this.element = element;
    this.handler = handler;
    element.addEventListener('touchstart', this, false);
};
FastButton.prototype.handleEvent = function(event) {
    switch (event.type) {
       case 'touchstart': this.onTouchStart(event); break;
       case 'touchmove': this.onTouchMove(event); break;
       case 'touchend': this.onClick(event); break;
       case 'click': this.onClick(event); break;
    }
 };
FastButton.prototype.onTouchStart = function(event) {
    event.stopPropagation();
    this.element.addEventListener('touchend', this, false);
    document.body.addEventListener('touchmove', this, false);
    this.startX = event.touches[0].clientX;
    this.startY = event.touches[0].clientY;
    isMoving = false;
 };
FastButton.prototype.onTouchMove = function(event) {
    if(Math.abs(event.touches[0].clientX - this.startX) > 10 || Math.abs(event.touches[0].clientY - this.startY) > 10) {
       this.reset();
    }
 };
FastButton.prototype.onClick = function(event) {
    this.reset();
    this.handler(event);
    if(event.type == 'touchend') {
       preventGhostClick(this.startX, this.startY);
    }
 };
FastButton.prototype.reset = function() {
    this.element.removeEventListener('touchend', this, false);
    document.body.removeEventListener('touchmove', this, false);
};
function preventGhostClick(x, y) {
    coordinates.push(x, y);
    window.setTimeout(gpop, 2500);
};
function gpop() {
    coordinates.splice(0, 2);
};
function gonClick(event) {
    for(var i = 0; i < coordinates.length; i += 2) {
       var x = coordinates[i];
       var y = coordinates[i + 1];
       if(Math.abs(event.clientX - x) < 25 && Math.abs(event.clientY - y) < 25) {
          event.stopPropagation();
          event.preventDefault();
       }
    }
};
document.addEventListener('click', gonClick, true);
var coordinates = [];
function initFastButtons() {
    new FastButton(document.getElementById("fastclick"), goSomewhere);
};
function goSomewhere() {
    var theTarget = document.elementFromPoint(this.startX, this.startY);
    if(theTarget.nodeType == 3) theTarget = theTarget.parentNode;
    var theEvent = document.createEvent('MouseEvents');
    theEvent.initEvent('click', true, true);
    theTarget.dispatchEvent(theEvent);
};
//========================================================

//When using jQuery call init on domReady-Event
$(document).ready(function() {
initFastButtons();
})

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM