本文介绍了jQuery Mobile Listview - Phantom /未刷新在Android 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android模拟器(jQuery Mobile + PhoneGap,Android 4)中看到以下插入的 listview

I see the following botched listview in the Android Emulator (jQuery Mobile + PhoneGap, Android 4):

当页面是首先显示,列表按预期显示,但随后内容立即被隐藏。触摸显示几次即可更新:

When the page is first displayed, the list is displayed as expected, but then the content is immediately hidden. Touching the display a few times updates to:

列表本身并不奇怪,例如:

The list itself is nothing unusual, i.e.:

<div data-role="page" class="type-home" id="dine-around-list" data-add-back-btn="true">
    <div data-role="header" data-position="fixed" data-theme="e">
        <h1>Venue</h1>
    </div>
    <div data-role="content" class="content">
        <h3>Restaurants</h3>
        <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
            <li><a href="#dinearound1">EDGE Restaurant at The Four Seasons Denver</a></li>
            <li><a href="#dinearound3">The Ninth Door</a></li>
            <li><a href="#dinearound4">Bistro Vend&#244;me</a></li>
            <li><a href="#dinearound5">JAX Fish House &amp; Oyster Bar</a></li>
            <li><a href="#dinearound6">Venice Ristorante &amp; Wine Bar</a></li>
            <li><a href="#dinearound7">The Kitchen</a></li>
            <li><a href="#dinearound8">Capital Grille</a></li>
            <li><a href="#dinearound9">ChoLon</a></li>
            <li><a href="#dinearound10">Prima Ristorante</a></li>
            <li><a href="#dinearound11">Osteria Marco</a></li>
        </ul>
    </div>
</div>

有什么想法为什么会发生?我在Android模拟器中只能在Android 4上看到这个内容,而不是其他任何Android版本。

Any idea why this would happen? I have only seen this on Android 4 in the Android Emulator, not on any other Android version.

UPDATE :一般建议是在清单中激活硬件加速,即:

UPDATE: General recommendation is to activate hardware acceleration in the manifest, i.e.:

<application android:icon="@drawable/icon"
             android:label="@string/app_name"
             android:hardwareAccelerated="true" >

您也可以在代码中执行此操作,例如:

You can also do this in code, i.e.:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH ){
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
}

不起作用。

推荐答案

奇怪的是,从应用程序中使用的自定义CSS中删除以下内容解决了问题:

Strangely, removing the following from the custom CSS used in the app solved the problem:

.ui-page { -webkit-backface-visibility: hidden; }

此行是之前添加的,目的是在Android上的页面转换期间消除闪烁通过指定 $。mobile.defaultPageTransition ='none'; 并通过它生活)。

This line was added before in an attempt to eliminate flicker during page transitions on Android (which was eventually solved by specifying $.mobile.defaultPageTransition = 'none'; and living with it).

奇数 - 解决方案似乎与问题无关。

It is an odd one - the solution seemed to have nothing to do with the problem.

这篇关于jQuery Mobile Listview - Phantom /未刷新在Android 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 19:23