ReadMoreTextView is a lightweight Android library that provides an easy implementation of "Read More" functionality for TextViews. It allows users to expand long text content for a better user experience.
- Simple integration with any TextView.
- Customizable "Read More" label.
- Customizable "Read Less" label.
- Adjustable maximum number of lines for the collapsed state.
- Smooth animation when expanding the text.
Add the following dependency to your app's build.gradle file:
Add the JitPack link to your project's build.gradle
file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Next, add the following dependency to your app's build.gradle
file:
dependencies {
implementation 'com.github.colourmoon:readmore-textview:v1.0.2'
}
To use ReadMoreTextView in your project, follow these steps:
<com.colormoon.readmoretextview.ReadMoreTextView
android:layout_width="match_parent"
android:id="@+id/tvReadMoreLess"
android:textColor="#000000"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="HERE GIVE YOUR TEXT"/>
Initialize the ReadMoreTextView in your activity or fragment:
ReadMoreTextView textView = findViewById(R.id.tvReadMoreLess);
textView.setText("YOUR LONG TEXT HERE");
Here you can change the text for Read More Or Read Less
textView.setCollapsedText("Read More")
textView.setExpandedText("Read Less")
Here you can change the text color for Read More Or Read Less
textView.setCollapsedTextColor(R.color.blue)
textView.setExpandedTextColor(R.color.blue)
Here you can change the text trim lines, You can select after how many lines you need to show Read More
textView.setTrimLines(4) //By Default it will be only 2 lines
That's it! Now your TextView will automatically show the "Read More" link when the text is longer than the specified maximum number of lines.
Contributions to ReadMoreTextView are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
ReadMoreTextView is released under the MIT License. See the LICENSE file for more details.
For any questions or support related to ReadMoreTextView, you can reach out to us at ronilgwalani@colourmoon.com, pushpendra@thecolourmoon.com or join our community forum.
The ReadMoreTextView library was developed by Ronil Gwalani