2012-06-21 11 views
8

私は検索、いくつかのボタン、webviews(1表示2不可視)とadmob adviewのためのテキストボックスを持っているAndroidアプリケーションがあります。アプリは単にいくつかの特別なサイトを検索し、それはエミュレータ、サムスン銀河のデバイスで素晴らしい作品。 HTC One Xに問題があります(他のHTCモデルについてはわかりません)。HTC One X - Webviewはタッチ後に白/空になります

問題は、検索ボタンをクリックすると、Webビューがページを読み込むことです。スクロールしても「時々」タッチすると、Webビューはスクロールバー付きの完全に白い領域に戻ります。これは特に広告の更新後に発生します。時には広告の背景とテキスト領域が完全に白くなり、読み込み不可能になることさえあります。広告の上に青い矢印と青い電話の画像が表示されたままになります!

誰にもこのような問題や解決策はありますか?前もって感謝します。

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#ffffff" 
    android:orientation="vertical" > 

    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" > 

     <LinearLayout 
      android:id="@+id/layoutDashboard" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical" 
      android:background="@drawable/border_shape" 
      android:orientation="vertical" 
      android:paddingTop="1sp" > 

      <EditText 
       android:id="@+id/editxtKeyword" 
       android:layout_width="fill_parent" 
       android:layout_height="43dp" 
       android:layout_marginLeft="1dp" 
       android:layout_marginRight="1dp" 
       android:layout_marginTop="2dp" 
       android:ems="10" 
       android:hint="@string/editxtKeyword_hint" 
       android:singleLine="true" > 
      </EditText> 

      <HorizontalScrollView 
       android:id="@+id/horizontalScrollView1" 
       android:layout_width="fill_parent" 
       android:layout_height="0dip" 
       android:layout_gravity="center_vertical" 
       android:layout_weight="0.30" 
       android:paddingBottom="2dp" 
       android:paddingLeft="1dp" 
       android:scrollbars="none" > 

       <LinearLayout 
        android:id="@+id/layoutButtons" 
        android:layout_width="wrap_content" 
        android:layout_height="fill_parent" 
        android:layout_gravity="center_vertical" 
        android:layout_marginTop="0dp" 
        android:layout_marginBottom="1dp" 
        android:layout_marginLeft="1dp" 
        android:layout_marginRight="1dp" 
        android:orientation="horizontal" > 
< 
        <Button 
         android:id="@+id/btnAk" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_vertical" 
         android:layout_margin="1dp" 
         android:background="@drawable/custom_button_shape" 
         android:text="asd" /> 

        <Button 
         android:id="@+id/btnCm" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_vertical" 
         android:layout_margin="1dp" 
         android:background="@drawable/custom_button_shape" 
         android:text="csm" /> 

       </LinearLayout> 
      </HorizontalScrollView> 
     </LinearLayout> 

     <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" > 

      <WebView 
       android:id="@+id/webV" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_above="@+id/linlaylay1" 
       android:visibility="visible" /> 

      <WebView 
       android:id="@+id/webVAnalytics" 
       android:layout_width="1dp" 
       android:layout_height="0dp" 
       android:visibility="invisible" /> 

      <WebView 
       android:id="@+id/WebVSahibinden" 
       android:layout_width="1dp" 
       android:layout_height="0dp" 
       android:visibility="invisible" /> 

      <LinearLayout 
       android:id="@+id/linlaylay1" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignParentBottom="true" 
       android:layout_margin="0dp" 
       android:orientation="vertical" 
       android:padding="0dp" > 

       <com.google.ads.AdView 
        android:id="@+id/adViewSmall" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center_horizontal|top" 
        ads:adSize="BANNER" 
        ads:adUnitId="a123123" 
        ads:loadAdOnCreate="true" 
        ads:testDevices="TEST_EMULATOR" /> 
      </LinearLayout> 
     </RelativeLayout> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/layoutProgress" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="top|center_horizontal" 
     android:layout_marginBottom="50dp" 
     android:layout_marginTop="5dp" 
     android:background="@drawable/progress_shape" 
     android:padding="2dp" 
     android:visibility="invisible" > 

     <TextView 
      android:id="@+id/lblLoading" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_margin="2dp" 
      android:text="@string/msg_loading" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
      android:textColor="#000000" /> 

     <ImageButton 
      android:contentDescription="@string/dialog_cancel" 
      android:id="@+id/btnStop" 
      android:layout_width="30dp" 
      android:layout_height="30dp" 
      android:src="@drawable/stop" /> 
    </LinearLayout> 

</FrameLayout> 
+0

前を見ないでください!エラーを引き起こすいくつかの発生があります。しかし、htcは新しいデバイスをリリースし、このデバイスでは問題は発生しません。 – Yaya

答えて

2

が互いの上にハードウェアアクセラレーション見解を示した多くの問題があります。

は、ここに私のレイアウトxmlです。私はあなたのレイアウトをWebビューやスクロール・ビューと重ならないように、またはハードウェアアクセラレーションを無効にするように修正します。

+0

ランス、ご返信ありがとうございます。実際にはWebビューは重複しません。なぜなら、そのうち1つしか表示されていないためです。ローディング中はEditText領域に "ローディング"ラベルが表示され、それはすべて重なっています。ハードウェアアクセラレーションを無効にすることはどういう意味ですか? –

+0

コード内の個々のビューまたは完全にマニフェストでハードウェアアクセラレーションをオフにすることができます。これは、ビューがGPUテクスチャに変換され、そのように描画されるAndroidの新機能です。 ところで、私はしばしば、カメラのプレビューのようなものが目に見えないときでさえ物事に干渉するのを見ました。あなたが実際に行っているようにビューを積み重ねるのであれば、不可視ではなく消えてしまった場合は、それを少し変更した方が良いでしょう。それは私の前のバグ修正です。 –

1

私はこの問題をHTC携帯電話での単一のWebviewで見てきました。 One of the comments in this bug threadは、WebViewのパフォーマンスを最適化するための提案をしています。このバグは3D変換に関するものですが、一般的にWebViewsに役立つコメントのテクニックを見つけました。

This presentation at Google I/O 2012は、WebViewのトピックに関する一般的な情報も提供します。

両方とも、動的コンテンツを「レイヤー」に配置することをお勧めします。これは、要素に、このCSSルール割り当てる意味:このルールを適用することにより

-webkit-transform: translate3d(0, 0, 0); 

を、Androidのは、この「それが(ほぼ)無料で、後にアニメーションできるように、独自の風合いに事前に複合層にブラウザに指示します」行動は自由ではありません - それはより多くの記憶を消費するので、私はそれを賢明に適用します。上にリンクされたプレゼンテーションは、なぜその理由を説明する良い仕事です。

私の場合、このルールをページ全体を囲むDIVに適用することで、「白いスクリーン」を避けることができました。このページは、1秒間白くレンダリングされ、コンテンツをレンダリングすることがあります。私はこのテクニックを適用する前に "白い"ページが永遠に残っているのを見たことがありません。私は、制御不能なメモリ消費を見ていませんでした。 YMMV。

レイアウトを簡略化するためにできることをお勧めします。簡単に言ったが、良い提案はin the docsで見つけることができる。

+1

私はいくつかのハッキングを読んで、すべてのHTCウェブビューの問題を回避するために多くの方法を試しました。結局のところ、これは働いた唯一のものでした。ありがとう! –

+0

ダニエル、このアプローチが他の誰かのために働いたことを聞いてうれしいです。これは私が遭遇した奇妙な問題の1つでした。 –

+0

は私のためには機能しません:( –

2

A known bug

あなたのWebView上のハードウェアアクセラレーションを無効にしますが、古いデバイスを壊さない方法で行うことを確認することができます:

if(android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.HONEYCOMB){ 
    //mWebView is some WebView 
    mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); 
} 

警告

  • ビデオはブラウザで再生されません
  • スクロールはできませんほぼ同じように滑らかになります

これはJelly Beanでバグに応じて修正されていますが、個人的に確認できませんでした。

関連する問題