설정한 최대 라인수에 따라 텍스트의 확장, 축소가 가능한 TextView 입니다.

Overview

ReadMoreView

유튜브 앱과 같이 '더보기' 기능이 포함된 TextView 입니다. 기존 TextView 와 같이 TextSize, color, font 등의 속성 적용이 가능합니다.

dependency

최상위 수준 build.gradle

allprojects {
    repositories {
      ...
      maven { url 'https://jitpack.io' }
    }
}

app 수준 build.gradle

dependencies {
    implementation 'com.github.jeonjungin:ReadMoreView:v1.0.0'
    //  v1.0.0 은 최초 버전입니다.
}
  

xml

<com.willbegod.readmore.view.ReadMoreView
  ...
  android:textColor="@color/black"
  android:textSize="20sp"
  app:collapseBtnText="축소"
  app:expandBtnText="확장"
  app:btnColor="@color/purple_500"
  app:btnSize="15sp"
  app:colMaxLines="2"
  app:originalText="원하는 텍스트를 넣어주세요 :)"
  />

collapseBtnText

ReadMoreView 내에 표시되는 '축소' 기능 버튼의 String을 정의합니다. 단, 빈 String 을 입력하는 경우 표시되지 않습니다. 기본값은 '닫기' 입니다.

  app:collapseBtnText="축소"

expandBtnText

ReadMoreView 내에 표시되는 '확장' 기능 버튼의 String을 정의합니다. 단, 빈 String 을 입력하는 경우 표시되지 않습니다. 기본값은 '기더보기' 입니다.

  app:expandBtnText="확장"

btnColor

ReadMoreView 내에 표시되는 '축소', '확장' 기능 버튼의 color를 정의합니다. 기본값은 Color.Black 입니다.

  app:btnColor="@color/black"

btnSize

ReadMoreView 내에 표시되는 '축소', '확장' 기능 버튼의 size를 정의합니다.

  app:btnSize="15sp"

colMaxLines

ReadMoreView 축소 상태시 최대 라인 수를 정의합니다. 기본값은 Int.MAX_VALUE 입니다.

  app:colMaxLines="2"

originalText

ReadMoreView 에 표시될 String 전문을 정의합니다. collapse 상태인 경우 colMaxLines 속성 값에 따라 최대 라인 수 만큼만 표시됩니다. expanded 상태인 경우 String 전문이 표시됩니다.

  app:originalText="원하는 텍스트를 넣어주세요 :)"

클래스 필드 및 메서드

originalText

ReadMoreView 에 표시될 String 전문을 정의합니다. xml 속성 originalText 와 동일합니다.

  readMoreView.originalText = "원하는 텍스트를 넣어주세요 :)"

isExpanded

ReadMoreView 의 '확장' 상태 여부를 반환합니다. (Boolean)

  readMoreView.isExpanded == true

isCollapsed

ReadMoreView 의 '축소' 상태 여부를 반환합니다. (Boolean)

  readMoreView.isCollapsed == true

expand()

ReadMoreView 의 상태를 '확장' 으로 변경합니다. 이미 확장 상태인 경우 동작하지 않습니다.

  readMoreView.expand()

collapse()

ReadMoreView 의 상태를 '축소' 로 변경합니다. 이미 축소 상태인 경우 동작하지 않습니다.

  readMoreView.collapse()

toggle()

ReadMoreView 의 상태를 '반전' 시킵니다.

  readMoreView.toggle()

setStateChangedListener(listener: ((isExpanded: Boolean) -> Unit)?)

ReadMoreView 의 확장/축소 상태 변경 callback 을 설정합니다. callback 함수는 확장 상태는 true, 축소 상태로 변경되는 경우 false 가 인자로 인입됩니다.

  readMoreView.setStateChangedLisftener { isExpanded ->
    if (isExpanded) {
      // 필요한 동작
    }
  }

setExpandableChangedListener(listener: ((isExpandable: Boolean) -> Unit?))

ReadMoreView 가 조건을 만족하여 확장/축소 가능 여부 변경 callback 을 설정합니다. 원본 String(originalText) 가 View 의 너비에 맞춰 표현될때, 최대 라인 수 (colMaxLines) 를 넘어서는 경우 callback 함수의 인자로 true 가 인입됩니다.

  readMoreView.setExpandableChangedListener { isExpandable ->
    if (isExpandable) {
      // 필요한 동작
    }
  }
You might also like...
This is based on an open source autosizing textview for Android.

SizeAdjustingTextView This is based on an open source autosizing textview for Android I found a few weeks ago. The initial approach didn't resize mult

Custom View classes for TextView, EditText & Buttons - to set custom fonts
Custom View classes for TextView, EditText & Buttons - to set custom fonts

CustomFontView Custom font classes for TextView, EditText & Buttons How to integrate the library in your app? Gradle Dependecy dependencies {

Android TextView with rich support of compound drawables
Android TextView with rich support of compound drawables

TextViewRichDrawable This is a tiny library which empowers TextView's (and its inheritors) compound drawables with size specifying, vector support and

Animation effects to text, not really textview
Animation effects to text, not really textview

HTextView Animation effects with custom font support to TextView see iOS Effects see Flutter Effects Screenshot type gif Scale Evaporate Fall Line Typ

Android's TextView that can expand/collapse like the Google Play's app description

ExpandableTextView ExpandableTextView is an Android library that allows developers to easily create an TextView which can expand/collapse just like th

A library to show emoji in TextView, EditText (like WhatsApp) for Android
A library to show emoji in TextView, EditText (like WhatsApp) for Android

Discontinued This projected is discontinued. Please consider using other alternative, i.e EmojiCompat. Contact me if you want to continue working on a

A TextView that automatically resizes text to fit perfectly within its bounds.
A TextView that automatically resizes text to fit perfectly within its bounds.

AutoFitTextView A TextView that automatically resizes text to fit perfectly within its bounds. Usage dependencies { compile 'me.grantland:autofitt

Android experiment showing a sinking TextView
Android experiment showing a sinking TextView

Titanic is an Android experiment reproducing this effect.

A Custom TextView with trim text
A Custom TextView with trim text

ReadMoreTextView A Custom TextView with trim text Download To add the ReadMoreTextView library to your Android Studio project, simply add the followin

Advanced Android TextView

Advanced Android TextView Companion app for my Advanced Android TextView talk, demostrating: Animated CompoundDrawable Text shadow Custom font Non-bre

AutoLinkTextView is TextView that supports Hashtags (#), Mentions (@) , URLs (http://), Phone and Email automatically detecting and ability to handle clicks.
AutoLinkTextView is TextView that supports Hashtags (#), Mentions (@) , URLs (http://), Phone and Email automatically detecting and ability to handle clicks.

AutoLinkTextView Deprecated Please use the new version of AutoLinkTextView AutoLinkTextView is TextView that supports Hashtags (#), Mentions (@) , URL

Implementation of a TextView and all its direct/indirect subclasses with native support for the Roboto fonts, includes the brand new Roboto Slab fonts.
Implementation of a TextView and all its direct/indirect subclasses with native support for the Roboto fonts, includes the brand new Roboto Slab fonts.

Android-RobotoTextView Implementation of a TextView and all its direct/indirect subclasses with native support for the Roboto fonts, includes the bran

A TextView that simulates the effect from the app Secret where the characters fade in/out at different speeds.
A TextView that simulates the effect from the app Secret where the characters fade in/out at different speeds.

SecretTextView A TextView that simulates the effect from the app Secret where the characters fade in/out at different speeds. How To Use Use it just l

This is based on an open source autosizing textview for Android.

SizeAdjustingTextView This is based on an open source autosizing textview for Android I found a few weeks ago. The initial approach didn't resize mult

An extension of Android's TextView, EditText and Button that let's you use the font of your choice

AnyTextView (deprecated) Note: AnyTextView is no longer being maintained. I recommend replacing AnyTextView with the Calligraphy library instead. Frus

Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Provides easy means to validate with dependencies.
Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Provides easy means to validate with dependencies.

android-formidable-validation Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Pr

Simple way to create linked text, such as @username or #hashtag, in Android TextView and EditText
Simple way to create linked text, such as @username or #hashtag, in Android TextView and EditText

Simple Linkable Text Simple way to create link text, such as @username or #hashtag, in Android TextView and EditText Installation Gradle Add dependenc

Customized and Expandable TextView
Customized and Expandable TextView

Customized and Expandable TextView Simple library to change the Textview as rectangle, circle and square shapes by adding one line of code in xml file

Lightweight android library for highlighting sections of a textview, with optional callbacks.
Lightweight android library for highlighting sections of a textview, with optional callbacks.

Linker Lightweight android library for highlighting Strings inside of a textview (ignoring case), with optional callbacks. Language: Java MinSDK: 17 J

Releases(v1.0.0)
Owner
junginjungin
junginjungin
안드로이드 개발에 관련된 내용이라면 어떤 것이든 발표 형식으로 공유하는 스터디 입니다.

Android-Seminar-Study Study Notion : Study Notion Link ?? 스터디 규칙 / 소개 안드로이드 개발에 관련된 내용이라면 어떤 것이든 공유하는 스터디 입니다. 안드로이드 개발을 배워 나가면서 모르고 무심코 지나 쳤던것, 좀 더 공

Kangraemin 6 Nov 7, 2021
DevFest 2021 ComposeFest 코드랩 Repo 입니다

ComposeFest2021 안녕하세요 Compose 코드랩에 오신걸 환영합니다. 다음은 코드랩을 진행하기 위한 안내입니다. 진행 일정 2021년 11월 1일 ~ 30일 매주 월요일 코드랩 진행을 돕기 위한 주요 설명 영상을 공개합니다. ?? 영상 보러가기 Compos

GDG Korea Android 127 Nov 7, 2022
Github Repository Search 어플리케이션 입니다.

github-search ?? Introduction Github Search API 를 사용해서 검색된 레포지토리 리스트를 보여줍니다. EditText에서 텍스트를 입력하면 검색 API를 호출하고, debounce를 사용해서 호출 간격을 조절했습니다. 각 레포지토리는

null 2 Jan 25, 2022
A simple and flexible Checked TextView or Checkable TextView

CheckableTextView Checkable TextView [KOTLIN] ⚡ A simple and flexible Checked TextView or Checkable TextView written in Kotlin ⚡ What's New Animation

null 110 Nov 20, 2022
Mentions-TextView - Make Mentions and hashtags clickable in Textview

Mentions Textview Custome Textview with Mentions and hashtags being clickable. D

null 2 Jan 9, 2022
() An Android TextView with a shimmering effect

Shimmer for Android This library is DEPRECATED, as I don't have time to mainatin it anymore. But feel free to go through the code and copy that into y

Romain Piel 2k Jan 9, 2023
() Android experiment showing a sinking TextView

Titanic for Android This library is DEPRECATED, as I don't have time to mainatin it anymore. But feel free to go through the code and copy that into y

Romain Piel 1.8k Dec 15, 2022
A TextView that automatically resizes text to fit perfectly within its bounds.

AutoFitTextView A TextView that automatically resizes text to fit perfectly within its bounds. Usage dependencies { compile 'me.grantland:autofitt

Grantland Chew 4.2k Jan 8, 2023
A TextView that simulates the effect from the app Secret where the characters fade in/out at different speeds.

SecretTextView A TextView that simulates the effect from the app Secret where the characters fade in/out at different speeds. How To Use Use it just l

Matt Kula 611 Nov 7, 2022
Android's TextView that can expand/collapse like the Google Play's app description

ExpandableTextView ExpandableTextView is an Android library that allows developers to easily create an TextView which can expand/collapse just like th

Manabu S. 4k Jan 8, 2023