Say hi to Fade-In TextView! A custom TextView library which makes every character appear with a smooth alpha animation.
The Fade-In TextView library inherits its properties directly from the native TextView class, which means that all the native TextView methods are supported. There are practically no limitations including multiline support. The library also has some of its own methods and attributes which offer full control over the View.
Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation ('com.github.chtgupta:FadeInTextView-Android:2.1.0') {
exclude module: 'app'
}
}
Step 1. Add the JitPack repository to your build file
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Step 2. Add the dependency
<dependency>
<groupId>com.github.chtgupta</groupId>
<artifactId>FadeInTextView-Android</artifactId>
<version>2.1.0</version>
</dependency>
<believe.cht.fadeintextview.TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="30sp"
android:textColor="@android:color/black"
app:letterDuration="250"/>
believe.cht.fadeintextview.TextView textView = findViewById(R.id.textView);
// setting a listener for tracking events (optional)
textView.setListener(new TextViewListener() {
@Override
public void onTextStart() {
Toast.makeText(getBaseContext(), "onTextStart() fired!", Toast.LENGTH_SHORT).show();
}
@Override
public void onTextFinish() {
Toast.makeText(getBaseContext(), "onTextFinish() fired!", Toast.LENGTH_SHORT).show();
}
});
textView.setLetterDuration(250); // sets letter duration programmatically
textView.setText(); // sets the text with animation (Read "KNOWN BUGS" if it doesn't give desired results)
textView.isAnimating(); // returns current boolean animation state (optional)
- 2.1.0
- Added TextViewListener
- Created methods to implement TextViewListener in TextView
- Implemented new additions in the demo app
- Added new logo by @mansya to the demo app
- 1.1
- Added preview text in demo app
- 1.0
- Initial release
- The default android:text attribute to set the initial text doesn't seem to work, will be fixed in coming versions.
- If setText() doesn't give desired results, consider calling it from a method and not directly from onCreate().
- Facing issues cloning/running the project? See this. (Not really a bug, I guess)
Chahat Gupta – @chtgupta – admin@speakapp.me
Distributed under the MIT license. See LICENSE
for more information.
https://github.com/chtgupta/FadeInTextView-Android/
- Fork it
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull request so that I can review changes
- Liked my work? Star it to show support!
- Used it in your app? Let me know and I'll include your app name, logo and link in this repository.
- Want to take this to another level? Read
CONTRIBUTING
again!
MIT License
Copyright (c) 2018 Chahat Gupta
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.