Skip to content

prongbang/ExpandableTextView

Repository files navigation

Expandable Text View

Expandable Text View Android Library

screenshot gif

Download

build.gradle

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

Support Library

implementation 'com.github.prongbang:expandabletextview:1.0.1'

AndroidX

implementation 'com.github.prongbang:expandabletextview:2.0.0'

How to use

MainActivity.kt

  btnExpand.setOnClickListener {
      tvDescription.expandTextView()
  }

  btnCollapse.setOnClickListener {
      tvDescription.collapseTextView()
  }

  btnCycle.setOnClickListener {
      tvDescription.cycleTextViewExpansion()
  }

activity_main.xml

    <com.prongbang.widget.ExpandableTextView
        android:id="@+id/tvDescription"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:maxLines="5"
        app:collapsedMaxLines="5"
        app:autoDuration="true"
        android:text="@string/label_description" />

Properties

app:duration="200"
app:collapsedMaxLines="5"
app:autoDuration="true"

Thank