Skip to content
Advertisement

Android:Problem in displaying text

I got a bulk of text in a file that has to be displayed in the textview
The text should fit exactly in the screen and the remaining text in next page and so on !

Now the problem is how to get the position of the text when it has come to the end of the screen ?

Is there any possibility of getting the X and Y coordinates of the text ?

I did that by getting the width and height of the screen using window.getWidth() and window.getHeight() and tried calculating Pixel Vs Text and displayed accordingly..
But the problem with that was ,when the bufferreader encounters a new line, it is taking the new line as a single character and so the text is going out of the screen.

Forgive me if there are any mistakes or errors in the above problem !!!

Thanks,
Siva Kumar

Advertisement

Answer

We can do one thing, I’m just guessing it.

We can take height of textview at runtime
we have font size
and space between 2 consecutive line

3rd parameter can be set in XML.

You can calculate space used by your text on the basis of these 2 above stated parameters and compare them with the height of textview.

I think you might able two find out, text is going out of screen or not.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement