Android JellyBean does not recognize getTextSize for AttriubteSet

I am using the AutoResizeTextView class, which I found here: https://stackoverflow.com/a/316618/

This works great before JellyBean. It would seem that JellyBean does not recognize getTextSize () from the textView AttributeSet attribute, which returns 0.0.

I tried to create custom xml attributes, but I use styles to use the AutoResizeTextView class and cannot include my own namespace in styles.xml.

Any idea of ​​a job for JellyBean to recognize this method?

+8
android attributes android-4.2-jelly-bean
source share
3 answers

I had the same problem and I just solved it with a fix in the AutoResizeTextView class

/** * When text changes, set the force resize flag to true and reset the text size. */ @Override protected void onTextChanged(final CharSequence text, final int start, final int before, final int after) { mNeedsResize = true; mTextSize = getTextSize(); // I ADDED THIS // Since this view may be reused, it is good to reset the text size resetTextSize(); } 

Now it works on 2.3, 4.0 and 4.1. pf

+11
source share

It works on the code, but problems arise when AutoResizeTextView is reused. For example, in ListView. After scaling up one entry in the list, some of the entries below may also be unnecessarily smaller. In this case, the onTextChanged method should look like this:

 @Override protected void onTextChanged(final CharSequence text, final int start, final int before, final int after) { needsResize = true; if (before == after) textSize = getTextSize(); else resetTextSize(); // Since this view may be reused, it is good to reset the text size } 
+4
source share

I saw a problem with Streaming. In the streaming video, when I tried to go fwd and bwd, I saw a restart.

0
source share

All Articles