more' text. app:readMoreMaxLines="3" app:readMoreOverflow="ellipsis" // Set 'read more' text and styles. app:readMoreText="@string/read_more" app:readMoreTextColor="?colorPrimary" app:readMoreTextFontFamily="sans-serif" app:readMoreTextSize="12sp" app:readMoreTextStyle="bold" app:readMoreTypeface="normal" app:readMoreTextUnderline="true" // Set textAppearance to 'read more' text. app:readMoreTextAppearance="@style/TextAppearance.AppCompat.Small" // If you want to use custom OnClickListener, you must be set this attribute to false. app:readMoreToggleEnabled="false" /> Usage • ୭ ࣻ • ؊ࠁӝ ޙҳ झఋੌ
readMoreMaxLines: Int ) { fun onTextLayout(result: TextLayoutResult) { val lastLineIndex = readMoreMaxLines - 1 val previous = textLayout val old = previous != null && previous.lineCount <= readMoreMaxLines && previous.isLineEllipsized(lastLineIndex) val new = result.lineCount <= readMoreMaxLines && result.isLineEllipsized(lastLineIndex) val changed = previous != result && old != new if (changed) { textLayout = result updateCollapsedText() } } ... } Library (୭ೠ সؘ പࣻܳ ۰Ҋ ઑѤਸ ୶о ')
→ 라이브러리 탐색 / 분석 → 구현) → 테스트 • 사용한 API • View: TextPaint, StaticLayout • Compose: TextMeasurer, BoxWithConstraints • “더 구현할 것은 없을까?” • Stateful → Stateless? • 정말 정말 정말 긴 텍스트? 정리