I'd like to suggest that it would be really convenient if it were possible 
to override TextView.makeNewLayout.

A somewhat common reason for overriding the TextView class is so that you 
can make some trivial modification to the text that it displays: Arrange it 
along the circumference of a circle, rotate it a bit, something like that. 
 The point is that you want the subclass to *be* a TextView, but to 
transform the text at the last minute.  There's a good chance that the 
transformation will change the dimensions of the view.  That's easy to 
handle, with code like this:

    *protected* *void* onMeasure(*int* widthMeasureSpec, 
*int*heightMeasureSpec){

        *super*.onMeasure(widthMeasureSpec, heightMeasureSpec);

        setMeasuredDimension(transformWidth(getMeasuredWidth()), 
transformHeight(getMeasuredHeight()));

    }

The problem is that doing this will, eventually cause the creation of a new 
Layout object, which controls the layout of the text.  Since that layout 
has the new dimensions for the TextView, the text it displays is 
re-wrapped: not what you want. 

 It is not possible to set the Layout object for a TextView, nor is the 
Layout object mutable.  If my analysis is correct, though, all that is 
necessary is removing the @hide from TextView.makeNewLayout so that 
sub-classes can override it.  That method seems like a perfectly reasonable 
architectural artifact of the TextView type.  It seems to me that exposing 
it wouldn't introduce any particularly onerous constraints.  ...and it sure 
would make it convenient to do this particular type of subclass of TextView.

Blake Meike

-- 
You received this message because you are subscribed to the Google Groups 
"Android Discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/android-discuss/-/kwLFyzEoueQJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/android-discuss?hl=en.

Reply via email to