2012-06-21 2 views
8

검색, 일부 버튼, 웹보기 (1 개 표시 2 개 표시 안함) 및 admob adview 용 텍스트 상자가있는 Android 애플리케이션이 있습니다. 응용 프로그램은 단지 일부 특수 사이트를 검색하고 그것은 에뮬레이터, 삼성 갤럭시 장치에서 잘 작동합니다. 하지만 HTC One X에 문제가 있습니다 (다른 HTC 모델에 대해서는 알지 못함).터치 후 HTC One X - Webview가 흰색/비어 있습니다.

문제는 검색 버튼을 클릭하면 웹보기가 페이지를로드한다는 것입니다. 스크롤 할 때조차도 "때때로"터치하려고하면 웹보기가 스크롤 막대가있는 완전히 흰색 영역으로 돌아갑니다. 특히 광고 새로 고침 후에 발생합니다. 때로는 광고의 배경과 텍스트 영역이 완전히 흰색이되므로 읽을 수도 없습니다. 광고에 그냥 파란색 화살표와 블루 전화 호출 이미지를 볼 수있어!

누구나이 문제와 다른 해결책이 있습니까? 미리 감사드립니다.

<?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입니다. 레이아웃을 수정하여 웹보기 또는 스크롤보기를 겹쳐 지거나 하드웨어 가속을 사용하지 않도록 설정했습니다.

+0

랜스, 답변 해 주셔서 감사합니다. 사실 1 개의 웹 뷰가 겹쳐 보이지 않으므로 실제로는 볼 수 없기 때문에 다른 웹 뷰는 겹치지 않습니다. 로드하는 동안 나는 EditText 영역 위에 "로딩"레이블을 보여 주며 모두 중복됩니다. 하드웨어 가속을 사용하지 않도록 설정하는 것은 무엇을 의미합니까? –

+0

코드에서 개별 뷰 또는 전체 매니페스트에서 하드웨어 가속을 끌 수 있습니다.이 뷰는 Android의 새로운 기능으로, 뷰가 GPU 텍스처로 변환되어 그려집니다. 그런데 저는 카메라 미리보기와 같은 것들이 보이지 않더라도 사물을 방해하는 것을 종종 보았습니다. 자신이하고있는 것처럼 실제로 뷰를 스택하려는 경우 보이지 않는 대신 사라진 것을 사용하면 작업을 약간 더 효과적으로 변경할 수 있습니다. 그 전에는 버그가 수정되었습니다. –

1

HTC 휴대 전화의 단일 웹보기에서이 문제가 발생했습니다. 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); 

을, 안드로이드는 "이 (거의) 무료로 나중에 애니메이션 할 수 있도록 사전 합성하는 레이어를 자신의 질감에 브라우저에 지시" 행동은 자유롭지 않습니다 - 그것은 더 많은 기억을 소비 할 수 있으므로 현명하게 적용 할 것입니다. 위에 링크 된 프리젠 테이션은 이유를 잘 설명합니다.

필자의 경우 전체 페이지를 감싸는 DIV에이 규칙을 적용하여 "화이트 스크린"을 피할 수있었습니다. 페이지가 때때로 잠시 동안 흰색으로 렌더링 된 다음 내용을 렌더링합니다. 이 기술을 적용하기 전에 "흰색"페이지가 영원히 지속되는 것을 보지 못했습니다. 제어 불능 메모리 소비를 보지 못했습니다. YMMV.

레이아웃을 단순화하기 위해 할 수있는 일을 제안합니다. 쉽게 말했지만, 좋은 제안은 in the docs입니다.

+1

몇 가지 해킹을 읽고 모든 HTC 웹뷰 문제를 해결하기 위해 여러 가지 방법을 시도했습니다. 결국 이것은 유일한 방법이었습니다. 감사! –

+0

Daniel,이 접근법이 다른 누군가에게 효과가 있었다는 소식을 듣게되어 기쁩니다. 이것은 제가 만난 가장 이상한 쟁점 중 하나였습니다. –

+0

나를 위해 작동하지 않습니다. –

2

A known bug

당신은 당신의 웹보기에 하드웨어 가속을 해제하지만, 구형 장치를 아프게하지 않는 방식으로 그렇게 확신 할 수 있습니다 :

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에서 수정되었지만 개인적으로 확인할 수 없었습니다.

관련 문제