This is a migrated thread and some comments may be shown as answers.

NativeScript HtmlView - different results between Android and iOS for the same Html-text

1 Answer 255 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marc
Top achievements
Rank 1
Marc asked on 30 Sep 2016, 04:40 PM

Hello,

we try to visualize RichText within the HtmlView component in our NativeScript app, like the following example:

<s>
    This text is striked through.
</s>
<strong>
    <s>
        <div style="text-align:right;">
            This text is striked through, fed and aligned right.
        </div>
    </s>
</strong>
<em>
    <div style="text-align:center;">
        This text is italic and centered.
    </div>
</em>
<ins>
    This Text is underlined.
</ins>

 

As you can see in the Screenshots, the sample text is visualized differently on Android 6, Android 7 (Emulator) and iOS 10. We are justing just basic Html tags.

Any hints, what we can do here?

 

Regards

1 Answer, 1 is accepted

Sort by
0
Nick Iliev
Telerik team
answered on 05 Oct 2016, 11:34 AM
Hi Marc,

The reason this is happening is because behind HtmlView actually, we have implementations of UITextView for iOS and android.widget.TextView for Android. Now the iOS text-view has more implemented functionalities compared to the android one (for example inline styling is supported). The same applies to the different implementations of android.widget.TextView in the different API levels (we can see that in your screenshots - strike-out text is supported in Android 7 but not in Android 6). 
Overall all of this is coming from the native behaviour of the native components that lies behind HtmlView.

What I can suggest for more complex examples is to use WebView instead of HtmlView.
The HtmlView is recommended only for the most basic scenario, where the WebView will use more extended mechanism  to render HTMl based content (UIWebView for iOS and  WebViewClient for Android)


Regards,
Nikolay Iliev
Telerik by Progress
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
General Discussion
Asked by
Marc
Top achievements
Rank 1
Answers by
Nick Iliev
Telerik team
Share this question
or