Slide 1

Slide 1 text

AUTOSIZING TEXTVIEW

Slide 2

Slide 2 text

HELLO ABOUT ME @kettsun0123

Slide 3

Slide 3 text

AUTORESIZING TEXTVIEW AutosizingTextView

Slide 4

Slide 4 text

WHAT IS AUTOSIZING TEXTVIEW? AUTOSIZING TEXTVIEW IS… ▸ Android O (API 26) ~ ▸ ϨΠΞ΢τʹ͋ͬͨϑΥϯταΠζΛ ࣗಈͰબఆͯ͘͠ΕΔ ▸ supportϥΠϒϥϦ΋͋ΔΑ

Slide 5

Slide 5 text

AUTORESIZING TEXTVIEW ࢖͏ͱ͖ʹؾΛ͚ͭΔ͜ͱ

Slide 6

Slide 6 text

AUTOSIZING TEXTVIEW 1. layout_̋̋=“wrap_content” 2. android:singleLine=“true”

Slide 7

Slide 7 text

AUTOSIZING TEXTVIEW 1. layout_̋̋=“wrap_content” 2. android:singleLine=“true”

Slide 8

Slide 8 text

AUTOSIZING TEXTVIEW layout_height=“wrap_content”

Slide 9

Slide 9 text

AUTOSIZING TEXTVIEW

Slide 10

Slide 10 text

AUTOSIZING TEXTVIEW layout_width=“wrap_content”

Slide 11

Slide 11 text

AUTOSIZING TEXTVIEW

Slide 12

Slide 12 text

AUTOSIZING TEXTVIEW

Slide 13

Slide 13 text

AUTOSIZING TEXTVIEW if (mEllipsize != TextUtils.TruncateAt.MARQUEE) { // In a fixed-height view, so use our new text layout. if (mLayoutParams.height != LayoutParams.WRAP_CONTENT && mLayoutParams.height != LayoutParams.MATCH_PARENT) { autoSizeText(); invalidate(); return; } // Dynamic height, but height has stayed the same, // so use our new text layout. if (mLayout.getHeight() == oldht && (mHintLayout == null || mHintLayout.getHeight() == oldht)) { autoSizeText(); invalidate(); return; } } TextView.java > checkForRelayout()

Slide 14

Slide 14 text

AUTOSIZING TEXTVIEW @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if (mDeferScroll >= 0) { int curs = mDeferScroll; mDeferScroll = -1; bringPointIntoView(Math.min(curs, mText.length())); } // Call auto-size after the width and height have been calculated. autoSizeText(); } TextView.java > onLayout(c, l, t, r, b)

Slide 15

Slide 15 text

AUTOSIZING TEXTVIEW “wrap_content”

Slide 16

Slide 16 text

AUTOSIZING TEXTVIEW 1. layout_̋̋=“wrap_content” 2. android:singleLine=“true”

Slide 17

Slide 17 text

AUTOSIZING TEXTVIEW

Slide 18

Slide 18 text

AUTOSIZING TEXTVIEW TextView.java > applySingleLine(s, a, c) private void applySingleLine(boolean singleLine, boolean applyTransformation, boolean changeMaxLines) { mSingleLine = singleLine; if (singleLine) { setLines(1); setHorizontallyScrolling(true); ɹɹɹɹ ...

Slide 19

Slide 19 text

AUTORESIZING TEXTVIEW android:singleLine=“true”

Slide 20

Slide 20 text

CONCLUSION 1. layout_̋̋=“wrap_content” 2. android:singleLine=“true”

Slide 21

Slide 21 text

FIN Thanks:)