2015-02-16 4 views
1

У меня есть веб-представление, которое в зависимости от того, что пользователь нажимает на активность, отображает разные html-теги, однако теги не анализируются (т. Е. Веб-просмотр просто отображает необработанный текст) или doesnt показать что-нибудь вообще.Android-браузер не отображает/анализирует html-теги

WebView устанавливается:

((WebView)routeInfoMenu.findViewById(R.id.routeInfo_titleDesc)).loadData(routeDesc, "text/html", "utf-8"); 

содержание "outeDesc", например:

<p>This is some example text, this is <b>BOLD</b></p> 

XML-макет:

<RelativeLayout 
       android:id="@+id/rdm_routeInfo" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" > 

       <RelativeLayout 
        android:id="@+id/rdm_routeInfoWhite" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginBottom="40dp" 
        android:layout_marginLeft="25dp" 
        android:layout_marginRight="25dp" 
        android:layout_marginTop="30dp" 
        android:background="#FFFFFF" 
        android:clickable="true" > 

        <TextView 
         android:id="@+id/routeInfo_titleText" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_centerHorizontal="true" 
         android:layout_marginTop="20dp" 
         android:text="@string/route_name" 
         android:textColor="#000000" 
         android:textSize="19sp" 
         android:gravity="center" /> 

        <WebView 
         android:id="@+id/routeInfo_titleDesc" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:layout_margin="20dp" 
         android:layout_below="@id/routeInfo_titleText" 
         android:text="@string/route_desc" 
         android:textColor="#000000" 
         android:textSize="14sp" 
         android:maxLines="500" 
         android:scrollbars="vertical"/> 

       </RelativeLayout> 

ответ

0

Попробуйте использовать loadDataWithBaseURL() вместо loadData(). Пример:

((WebView)routeInfoMenu.findViewById(R.id.routeInfo_titleDesc)).loadDataWithBaseURL("", html, "text/html", "utf-8", "");