Search code examples
androidwebviewtextview

TextView X + Y scroll on Android


I'm creating a text viewer app that has a TextView, I'm setting color on specific words using SpannableString. The text is long enough so it requires a Horizontal + Vertical ScollView.

But HorizontalScrollView inside ScrollView not giving me satisfactory results, so I'm thinking about using a WebView.

My question is, Should I use a WebView for this purpose? and if yes then does WebView has these abilities?

• Selectable Specific Words (by user)

SpannableString support for color, text style (bold, italic)

• Custom font support (from .ttf)

UPDATE

I have implemented the WebView and those 3 abilities are working.

webView.loadDataWithBaseURL(null, text,"text/html","utf-8",null);

but I have a new issue, the text isn't scrolling horizontally anymore instead it's going on a new line. How do I prevent that?


Solution

  • Take a look at this TwoWayNestedScrollView.
    I've never tried it but it seems to be well done and also it is quite recent.