微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

离子Android TV

如何解决离子Android TV

我在Android TV的Ionic上使用APK时遇到问题,但是箭头的控件存在问题。

设备运行APK,但他的行为不正确。当使用箭头移动应用程序时,焦点必须不起作用。它会跳一些格。

以下是此应用使用的一些代码

TS:

matrixNodes: Array<any> = [];
matrixPosX: number = 0;
matrixPosY: number = 0;

。 。

keyboardAction(e) {
    let activeEle: any = this.matrixNodes[this.matrixPosY][this.matrixPosX];
    let parent: any = activeEle.parentNode;
    let moveRight = -224;
    let moveLeft = +224;

    if (this.matrixPosY != 0) {
        moveRight = -340;
        moveLeft = +340;
    }

    if (e.key == "ArrowRight") {
        if (this.matrixPosX < (this.matrixNodes[this.matrixPosY].length - 1)) {
            this.matrixPosX++;
            this.matrixNodes[this.matrixPosY][this.matrixPosX].focus();


            //SCROLL
            if (parent.style.left == 0 + 'px' || parent.style.left == 0) {
                if(this.matrixPosY != 0){
                    console.log(this.matrixPosY)
                    parent.style.left = '-350px';
                }else
                    parent.style.left = '-240px';

            } else {
                let old = parent.style.left;
                old = old.replace("px","");

                parent.style.left = (moveRight + parseInt(old)) + "px";
            }
            ////////////////
        }
    } else if (e.key == "ArrowLeft") {
        if (this.matrixPosX > 0) {
            this.matrixPosX--;
            this.matrixNodes[this.matrixPosY][this.matrixPosX].focus();


            //SCROLL
            if (parent.style.left == 0 + 'px' || parent.style.left == 0) {
                if(this.matrixPosY != 0)
                    parent.style.left = '350px';
                else
                    parent.style.left = '238px';
            } else {
                let old = parent.style.left;
                old = old.replace("px","");
                parent.style.left = (moveLeft + parseInt(old)) + "px";
            }
            /////////////////////////////
        } else {
            //Moverse al TAB
            let tab = document.getElementById("tab-button-home");
            tab.focus();
        }

函数(keyboardAction)通过事件keydown调用

我想知道为什么要跳一些div ..如果是因为在HTML中使用了其他事件或其他元素

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。