简体   繁体   English

Android响应式UI Webapp

[英]Android responsive UI webapp

I'm using bootstrap to make a responsive webapp. 我正在使用引导程序来制作响应式Web应用程序。

I started doing some tests with a navbar and a form in my website, the problem is the navbar in android because is being rendered with full width (like a desktop view) and chrome (for android) shows a zoom and this is not the idea behind the responsive UI. 我开始在网站上使用导航栏和表单进行一些测试,问题出在android中的导航栏,因为它以全角(如桌面视图)呈现,而chrome(对于android)则显示缩放,这不是主意响应式用户界面后面。

I also tried on my windows phone and it's rendering correctly, this happends with black berry mission tool for web develop wich emulates a tablet or mobile view. 我也在Windows Phone上尝试过,并且可以正确呈现,这是通过黑莓任务工具进行的,适用于Web开发,可模拟平板电脑或移动设备视图。

So the problem now is android... 所以现在的问题是android ...

My code for the navbar is this: 我的导航栏代码是这样的:

<nav class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="{% url 'vetpet.views.index.showIndex' %}">Vetpet Alpha</a>
        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Veterinarias <span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="{% url 'crear' %}"><span class="fa fa-plus" style="color:green"></span>Agregar Veterinaria</a></li>
                        <li><a href="{% url 'lista' %}"><span class="fa fa-list " ></span>Listar</a></li>
                    </ul>
                </li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">Link</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li class="divider"></li>
                        <li><a href="#">Separated link</a></li>
                    </ul>
                </li>
            </ul>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container-fluid -->
</nav>

Do you use the bootstrap basic template? 您是否使用引导程序基本模板? http://getbootstrap.com/getting-started/#template http://getbootstrap.com/getting-started/#template

If not, make sure you use the correct viewport settings. 如果没有,请确保使用正确的视口设置。 Have a look at this page: https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag 看看此页面: https : //developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag

Also keep in mind that css calculations are not available in androids default browser before 4.4. 另外请记住,在4.4之前的Android默认浏览器中无法使用css计算。 But you can use a workaround for this (box-sizing, positive padding, negative margin). 但是您可以为此使用一种解决方法(框大小,正填充,负边距)。

And in case you didn't know, you can use chrome to simulate webkit mobile devices. 如果您不知道,可以使用chrome来模拟webkit移动设备。 This also includes touch screen simulation, sensors and so on although it is not a perfect simulation: https://developers.google.com/web/fundamentals/tools/test/emulator 尽管这不是完美的模拟,但它还包括触摸屏模拟,传感器等: https : //developers.google.com/web/fundamentals/tools/test/emulator

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

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