8

私はここで見つけたクラスAutoResizeTextViewを利用しています: https ://stackoverflow.com/a/5535672/371778

これは、JellyBeanまでうまく機能していました。JellyBeanは0.0を返すため、textView AttributeSetからgetTextSize()を認識しないように見えます。

カスタムxml属性を作成しようとしましたが、スタイルを使用してAutoResizeTextViewクラスを使用し、styles.xml内にカスタム名前空間を含めることができません。

JellyBeanにこのメソッドを認識させるための回避策のアイデアはありますか?

4

3 に答える 3

11

同じ問題が発生しましたが、AutoResizeTextViewクラスを修正して解決しました。

 /**
 * 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();
}

現在、2.3、4.0、4.1で同じように動作します。pf

于 2012-07-19T09:33:05.680 に答える
4

上記のコードは機能しますが、AutoResizeTextViewを再利用すると問題が発生します。たとえば、ListViewで。リストの1つのエントリをスケーリングした後、以下の一部のエントリも不必要に小さくなる可能性があります。この場合、onTextChangedメソッドは次のようになります。

@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    
}
于 2012-10-24T10:26:07.873 に答える
0

ストリーミングに関する問題が発生しました。fwdとbwdを実行しようとしたときのストリーミングビデオで、再起動が見られました。

于 2012-08-30T08:49:48.617 に答える