开发者

How much portion of the given text will be displayed in a TextView

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 understa开发者_如何学运维nd 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..


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜