Example usage for android.text TextDirectionHeuristics FIRSTSTRONG_LTR

List of usage examples for android.text TextDirectionHeuristics FIRSTSTRONG_LTR

Introduction

In this page you can find the example usage for android.text TextDirectionHeuristics FIRSTSTRONG_LTR.

Prototype

TextDirectionHeuristic FIRSTSTRONG_LTR

To view the source code for android.text TextDirectionHeuristics FIRSTSTRONG_LTR.

Click Source Link

Document

Determines the direction based on the first strong directional character, including bidi format chars, falling back to left to right if it finds none.

Usage

From source file:android.support.v7.widget.AppCompatTextViewAutoSizeHelper.java

@TargetApi(23)
private StaticLayout createStaticLayoutForMeasuring(CharSequence text, Layout.Alignment alignment,
        int availableWidth, int maxLines) {
    // Can use the StaticLayout.Builder (along with TextView params added in or after
    // API 23) to construct the layout.
    final TextDirectionHeuristic textDirectionHeuristic = invokeAndReturnWithDefault(mTextView,
            "getTextDirectionHeuristic", TextDirectionHeuristics.FIRSTSTRONG_LTR);

    final StaticLayout.Builder layoutBuilder = StaticLayout.Builder.obtain(text, 0, text.length(),
            mTempTextPaint, availableWidth);

    return layoutBuilder.setAlignment(alignment)
            .setLineSpacing(mTextView.getLineSpacingExtra(), mTextView.getLineSpacingMultiplier())
            .setIncludePad(mTextView.getIncludeFontPadding()).setBreakStrategy(mTextView.getBreakStrategy())
            .setHyphenationFrequency(mTextView.getHyphenationFrequency())
            .setMaxLines(maxLines == -1 ? Integer.MAX_VALUE : maxLines).setTextDirection(textDirectionHeuristic)
            .build();/*from  w  ww.j  a  v  a2  s . co m*/
}