Anyone knows any efficient method of perform an animation that what is has to do is to display a text, character by character? Like:
T
Th
Thi
This
This i
This is
...
And so on.
Thanks!
Anyone knows any efficient method of perform an animation that what is has to do is to display a text, character by character? Like:
T
Th
Thi
This
This i
This is
...
And so on.
Thanks!
this new copy for Devunwired with xml layout
code use
then define textView in classStart
In theory it would be
You will of course do the iterate in your runmethod.
No need to set an extra class Use this, here tv is a textview in your layout just call
setCharacterDelay(150);
animateText("Sample String");
Just to add to @Devunwired's answer when working with Kotlin code,
I changed (in animateText function):
mHandler.postDelayed(mRunnable,mDelay)
tomRunnable.run()
so my final Kotlin class looks like this:
Also, a quick and dirty code (still in Kotlin) without subclassing.
Inside Activity:
A simple example for animating a loading dots:
animateText(". . .", 400){switchStateON()}
Most of the solutions provided above throw various errors. I guess the solutions are old. I stumbled on this android studio plugin and it works like charm.
1.Installation of AutoTypeTextView is preety simple. Just add in build.gradle
2.Add a new namespace which you will use for adding AutoTypeTextView and using its tags.
Hence your root layout should look like this
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:attv="http://schemas.android.com/apk/res-auto"
Add this to your xml file.
<com.dragankrstic.autotypetextview.AutoTypeTextView android:id="@+id/lblTextWithoutMistakes" android:layout_width="wrap_content" android:layout_height="wrap_content" attv:animateTextTypeWithoutMistakes="Hello World!" />
With just these three steps you are good to go. You can check out the documentation here for more details