2013-04-08 2 views
0

У меня есть веб-представление, в котором я показываю HTML, загруженный из жесткокодированной строки (около 1500 символов). HTML проверен в HTML-валидаторе. В html просто содержатся теги div и p, а не javascript. Только на Android версии 4 у меня есть пустая страница со свитком, на Android версии ниже 4 она работает нормально. К сожалению, я не могу разоблачить код дыры.Android 4 long html в webview

Есть ли разница в Android 4 WebView?

Мой код:

mWebView.setWebChromeClient(mWebChromeClient); 
mWebView.setWebViewClient(mWebViewClient); 
mWebView.addJavascriptInterface(new JavaScriptInterface(getActivity()),JavaScriptInterface.NAME); 

if (CLEAR_CACHE_ON_LOAD) { 
    mWebView.clearCache(true); 
} 

mWebView.getSettings().setJavaScriptEnabled(true); 
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false); 

mWebView.loadDataWithBaseURL("fake://", htmlString, "text/html", "UTF-8", "fake://"); 
//OR - 
mWebView.loadData(htmlBase64String, "text/html", "base64"); 

XML-:

<ScrollView 
    android:id="@+id/scrollView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_below="@+id/expandingView" > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 
     <FrameLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" > 
      <WebView 
       android:id="@+id/webview" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:fadingEdge="vertical" 
       android:layerType="software" 
       android:scrollbars="none" /> 

      <View 
       android:id="@+id/webViewClickOverlay" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" /> 
     </FrameLayout> 

     <LinearLayout 
      android:id="@+id/more_about_container" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/color_white_grey_selector" 
      android:gravity="center_vertical" 
      android:padding="@dimen/padding_medium" 
      android:visibility="gone" > 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginRight="@dimen/padding_medium" 
       android:text="@string/more_about" 
       android:textColor="@color/vocativ_purple" 
       android:textSize="@dimen/text_size_medium" 
       android:textStyle="bold" /> 
      <TextView 
       android:id="@+id/label_more_about" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:ellipsize="end" 
       android:lines="1" 
       android:text="SECOND NIGHT OF BLA" 
       android:textColor="@color/vocativ_pink" 
       android:textSize="@dimen/text_size_medium" 
       android:textStyle="bold" /> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:drawableRight="@drawable/ic_arrow_pink" /> 
     </LinearLayout> 

     <include 
      android:id="@+id/related_content_container" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      layout="@layout/widget_story_container" /> 
    </LinearLayout> 

</ScrollView> 
+0

некоторые код пожалуйста. –

ответ

0

Необходим чтобы установить андроида: layerType = "программное обеспечение" для андроида: layerType = "нет"

Смотреть следующий link

+0

Решено ли это сейчас? – kabuto178

+0

Да, это был слой в Интернете – NickF

Смежные вопросы