Is it possible to specify the number of lines displayed by a web view and to disable its scrolling and to have a read more label like websites like the picture attached?
Asked
Active
Viewed 1,396 times
2

eshteghel company
- 471
- 1
- 7
- 22
-
I believe you can do that using CSS . – Zamrony P. Juhara Nov 01 '16 at 08:29
-
so there is no workarounds by java – eshteghel company Nov 01 '16 at 08:29
-
If you want to do it with Java, then you do not need WebView. You can create custom view to meet your requirement – Zamrony P. Juhara Nov 01 '16 at 08:31
-
if you want to use webview. just do the "read more" inside the html.. in native also can do "read more" button to expand layout...but im not deny that there is other way to get what you want.. by injecting javascript and it will consider as hacky. – ZeroOne Nov 01 '16 at 08:56
1 Answers
1
You just need a combination of CSS and/or Javascript to achieve this and it better done in the website itself than in the Android app.
One way of Achieving in Android though, is to set height such that it shows only few lines along with disabling scrolling (refer Disable scrolling in webview?) and having a read more link below the webview, when clicked increase the height of the webview to MATCH_PARENT and also add the scrolling back and hide the read more item.
-
thanks, but how to regain the scrolling ability when i press Read Less, i.e. how to disable the motion event – eshteghel company Nov 01 '16 at 10:22
-
Reverse the steps, reduce the height back to the fixed one and reverse the logic on the touch event in the link, may be have a boolean to see if its in read less or read more – SanthoshN Nov 01 '16 at 15:44