1

i want to develop an ebook reader.. can i know how much text will be displayed on the given textview whose dimension is match_parent. or can i get the visible text of the textview... (if i copy the whole text on the textview)

i have tried various things like Paint:breakText.. it returns me the chars to be displayed in given width, but i dont understand how many lines will the textview have... so i cannot determine how many times i should loop the Paint:breakText..

also TextView:getLineCount returns 0, TextView:height returns -1 (bcz i have set it to match_parent)

plz help me out wid this..

Nital
  • 975
  • 3
  • 9
  • 15
  • look at this http://stackoverflow.com/questions/4322339/how-to-get-height-of-text-with-fixed-width-and-get-text-length-which-fits-in-a-f – æ-ra-code Jan 12 '12 at 12:54

2 Answers2

0

If you provide your textView's height with matchparent and enclose your textview within a scrollview, I think you can accommodate large amount of text within a single textview.

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
  • no.. my requirement is diffrent.. i dnt wanna scroll.. i wanna only display the text that wud be visible in this view (without scrolling) & den m using a view Flipper.. i.e wen the page is turned, it will display the rest of the contents in continuity of the string. – Nital May 30 '11 at 09:55
0

Maybe FontMetrics will help? You can see the doc for FontMetrics here: http://developer.android.com/reference/android/graphics/Paint.FontMetrics.html

DKIT
  • 3,471
  • 2
  • 20
  • 24
  • i dont think this will help.. as i need the **TextView** height.. wen i specify it in the layout as 'match_parent' – Nital May 30 '11 at 11:13