android Programming Glossary: tv.getpaint
How to scale/resize text to fit a TextView? http://stackoverflow.com/questions/2596452/how-to-scale-resize-text-to-fit-a-textview System.out.println tv.getPaddingTop tv.getPaddingBottom if minViewHeight 0 maxViewHeight 2 Rect currentBounds new Rect tv.getPaint .getTextBounds s 0 s.length currentBounds System.out.println initSize System.out.println maxViewHeight System.out.println.. float resultingSize 1 while currentBounds.height maxViewHeight resultingSize tv.setTextSize resultingSize tv.getPaint .getTextBounds s 0 s.length currentBounds System.out.println currentBounds.height tv.getPaddingBottom tv.getPaddingTop .. maxViewHeight just to be sure reduce the value tv.setTextSize resultingSize 1 I think the problem is in the use of tv.getPaint .getTextBounds ... . It always returns small numbers for the text bounds... small relative to the tv.getWidth and tv.getHeight..
How to check if a TextView String has been trimmed (marquee)? http://stackoverflow.com/questions/6187203/how-to-check-if-a-textview-string-has-been-trimmed-marquee textView private boolean isMarqueed String text int textWidth TextView tv Paint testPaint new Paint testPaint.set tv.getPaint boolean isMarquee true if textWidth 0 int availableWidth int textWidth tv.getPaddingLeft tv.getPaddingRight testPaint.measureText..
|