离子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 (将#修改为@)