Android showMoretextview
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies
{
implementation 'com.github.sanjaydraws:ShowMoreTextView:1.0.3'
}
<com.sanjayprajapat.showmoretextview.ShowMoreTextView
android:layout_width="wrap_content"
android:id="@+id/showMoreText"
android:layout_height="wrap_content"
app:showMoreMaxLine="3"
android:text="@string/long_text"
app:showMoreTextColor="#87012B"
app:showMoreText="...Show More"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
binding?.showMoreText?.addOnStateChangeListener(object :StateChangeListener{
override fun onStateChange(textState: TextState) {
when(textState){
TextState.EXPANDED -> Toast.makeText(this@MainActivity, "Expanded",Toast.LENGTH_SHORT).show()
TextState.COLLAPSED -> Toast.makeText(this@MainActivity, "Collapsed",Toast.LENGTH_SHORT).show()
}
}
})
👤 Sanjay Prajapat
- Twitter: @sanjay_draws
- Email: sprajapat8331@gmail.com
Feel free to ping me 😉
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Open an issue first to discuss what you would like to change.
- Fork the Project
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a pull request
Please make sure to update tests as appropriate.
Give a ⭐️ if this project helped you!
Copyright © 2022 - Sanjay Prajapat
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This README was generated by readgen ❤