如何让我的应用适合整个屏幕

时间:2018-05-30 09:52:39

标签: javascript html css webos lg

我正在不同的电视屏幕上开发应用程序,除了LG 32LJ57 WebOS之外,每个平台上的一切都运行良好,由于某种原因布局不适合整个屏幕,我尝试了不同的东西,1)添加元标记以适应屏幕,2)提高分辨率(注意默认分辨率为1920x1080),但没有任何变化,当我在LG webOS模拟器上测试时,一切都很合适但不在实际屏幕上,感谢您的帮助< / p>

<html>
    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="viewport" content="user-scalable=no, initial-scale=1, 
     maximum-scale=1, minimum-scale=1, width=device-width">
    <meta name='viewport' content='height=device-height'>
    <link rel="stylesheet" 

href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" 
integrity="sha384- 
Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" 
crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="css/index.css">
    <title>Libya TV</title>
</head>

<body>
    <section id="deviceready">
        <div class="row h-100 align-items-center text-center">
            <div class="col-xl-5 offset-xl-6">
                <div class="row row1">
                    <div class="col-xl-4">
                        <a id="0" class="logo" onclick="playMedia(0)"><img 
                               src="./img/Kids.png" class="img-fluid"></a>
                    </div>
                    <div class="col-xl-4">
                        <a id="1" class="logo" onclick="playMedia(1)"><img 
                               src="./img/sport.png" class="img-fluid"></a>
                    </div>
                    <div class="col-xl-4">
                        <a id="2" class="logo" onclick="playMedia(2)"><img 
                               src="./img/beauty.png" class="img-fluid"></a>
                    </div>
                </div>
                <div class="row row2">
                    <div class="col-xl-4">
                        <a id="3" class="logo" onclick="playMedia(3)"><img 
                               src="./img/doc.png" class="img-fluid"></a>
                    </div>
                    <div class="col-xl-4">
                        <a id="4" class="logo" onclick="playMedia(4)"><img 
                           src="./img/libyaTv.png" class="img-fluid"></a>
                    </div>
                    <div class="col-xl-4">
                        <a id="5" class="logo" onclick="playMedia(5)"><img 
                           src="./img/movies.png" class="img-fluid"></a>
                    </div>
                </div>

                <div class="row row3">
                    <div class="col-xl-4">
                        <a id="6" class="logo" onclick="playMedia(6)"><img 
                          src="./img/series.png" class="img-fluid"></a>
                    </div>
                    <div class="col-xl-4">
                        <a id="7" class="logo" onclick="playMedia(7)"><img 
                          src="./img/kojina.png" class="img-fluid"></a>
                    </div>

                    <div class="col-xl-4">
                        <a id="8" class="logo" onclick="playMedia(8)"><img 
                         src="./img/music.png" class="img-fluid"></a>
                    </div>
                </div>

                <div class="row row4">
                    <div class="col">
                        <p>
                            <span>NILESAT 11526 H</span>
                 <img src="./img/Layer%2015.png" class="img-fluid">
                 <img src="./img/square-twitter-256.png" class="img-fluid">
                 <img src="./img/app-icon21.png" class="img-fluid">
                            @Libyatvnetwork
                        </p>
                    </div>
                </div>

                <div class="row row5 ">
                    <div class="offset-1 ">
         <img src="./img/Layer%2016.png" class="img-fluid ">
         <img src="./img/appstore-icon-mobile-retina.png" class="img-fluid">
         <img src="./img/Group%2010%20copy.png" class="img-fluid">
                    </div>
                </div>
            </div>
        </div>
    </section>





    <link rel="stylesheet" href='css/video.css'>

    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="toast.js"></script>
    <script type="text/javascript" src="js/init.js"></script>
    <script type="text/javascript" src="js/media.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
</body>

enter image description here

3 个答案:

答案 0 :(得分:1)

也许电视无法处理1080分辨率(http://webostv.developer.lge.com/discover/specifications/webos-tv-platform/supported-app-resolution/

的应用程序

我猜你已经使用'resolution': '1920x1080'配置了appinfo.json,但你也设置了设备宽度为1280(content ="width=device-width")的HTML应用程序,所以基本上电视正在尝试使用两种不同的尺寸

要支持这些电视,您必须使用两个不同的appinfo.json发布两个应用程序,一个用于1080("resolution": "1920x1080"),另一个用于720("resolution": "1280x720"

答案 1 :(得分:0)

这是我用于我的应用的元标记,尝试添加viewport-fit=cover

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui, viewport-fit=cover">

答案 2 :(得分:0)

请添加你的CSS,你在包含的行div上有宽度吗?使用container-fluid来包含bootstrap中的行:

https://getbootstrap.com/docs/4.0/layout/overview/ - 尝试使用class container-fluid:

包装div中的行
<div class="container-fluid">
    <div class="row h-100 align-items-center text-center">
        <div class="col-xl-5 offset-xl-6">
            <div class="row row1">
                <div class="col-xl-4">
                    <a id="0" class="logo" onclick="playMedia(0)"><img 
                           src="./img/Kids.png" class="img-fluid"></a>
                </div>
                <div class="col-xl-4">
                    <a id="1" class="logo" onclick="playMedia(1)"><img 
                           src="./img/sport.png" class="img-fluid"></a>
                </div>
                <div class="col-xl-4">
                    <a id="2" class="logo" onclick="playMedia(2)"><img 
                           src="./img/beauty.png" class="img-fluid"></a>
                </div>
            </div>
            <div class="row row2">
                <div class="col-xl-4">
                    <a id="3" class="logo" onclick="playMedia(3)"><img 
                           src="./img/doc.png" class="img-fluid"></a>
                </div>
                <div class="col-xl-4">
                    <a id="4" class="logo" onclick="playMedia(4)"><img 
                       src="./img/libyaTv.png" class="img-fluid"></a>
                </div>
                <div class="col-xl-4">
                    <a id="5" class="logo" onclick="playMedia(5)"><img 
                       src="./img/movies.png" class="img-fluid"></a>
                </div>
            </div>

            <div class="row row3">
                <div class="col-xl-4">
                    <a id="6" class="logo" onclick="playMedia(6)"><img 
                      src="./img/series.png" class="img-fluid"></a>
                </div>
                <div class="col-xl-4">
                    <a id="7" class="logo" onclick="playMedia(7)"><img 
                      src="./img/kojina.png" class="img-fluid"></a>
                </div>

                <div class="col-xl-4">
                    <a id="8" class="logo" onclick="playMedia(8)"><img 
                     src="./img/music.png" class="img-fluid"></a>
                </div>
            </div>

            <div class="row row4">
                <div class="col">
                    <p>
                        <span>NILESAT 11526 H</span>
             <img src="./img/Layer%2015.png" class="img-fluid">
             <img src="./img/square-twitter-256.png" class="img-fluid">
             <img src="./img/app-icon21.png" class="img-fluid">
                        @Libyatvnetwork
                    </p>
                </div>
            </div>

            <div class="row row5 ">
                <div class="offset-1 ">
     <img src="./img/Layer%2016.png" class="img-fluid ">
     <img src="./img/appstore-icon-mobile-retina.png" class="img-fluid">
     <img src="./img/Group%2010%20copy.png" class="img-fluid">
                </div>
            </div>
        </div>
    </div>
</div>