How to link HTML string with webview in android app?

I currently have android: TextView bound to a string that may or may not contain HTML.

<TextView
        android:text="Medium Text"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:autoLink="all"
        android:padding="10dp"
        style="@style/ListItemText"
        local:MvxBind="Text Answer" />

Somehow I need to display this text using html rendered. So I decided to switch TextView to WebView and associate the same line with WebView. I am new to Android developer, so I'm not sure if this can be done, or if there is another way, I should approach this.

+4
source share
1 answer

HTML- TextFormatted TextView - ValueConverter, HTML ( Html.FromHtml(input))

public class FromHtmlValueConverter : MvxValueConverter<string>
{
   protected override object Convert(string value, Type targetType, object parameter, CultureInfo culture)
   {
       return Html.FromHtml(value);
   }
}

<TextView
    android:text="Medium Text"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:autoLink="all"
    android:padding="10dp"
    style="@style/ListItemText"
    local:MvxBind="TextFormatted FromHtml(Answer)" />

WebView - - LoadData . , UIWebView UIWebView MVVMCross

+8

All Articles