Asif Sb
Asif Sb

Reputation: 805

How to get "slide to unlock" animation for a text view in android?

Is there any way in android that I can achieve the slide to unlock animation in Android? I am having a text view where I want to animate that animation on it!

Here is my layout:

<LinearLayout
                android:id="@+id/ll_chooseLang"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv_chooseLanguage"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:lineSpacingMultiplier="1.2"
                     android:textColor="#fff"
                     android:textSize="25sp"
                    android:text="TextView" />

            </LinearLayout>

I have done fade out and fade in animation:

animSet=new AnimationSet(true);
    trans=new TranslateAnimation(400, 0,0, 0);
    trans.setDuration(2000);
    
    fadeIn=new AlphaAnimation(0.0f, 1.0f);
    fadeIn.setDuration(1800);
    fadeIn.setFillAfter(true);
    fadeout=new AlphaAnimation(1.0f, 0.0f);
    fadeout.setDuration(2000);
    fadeout.setFillAfter(true);
    
    animSet.addAnimation(trans);
    animSet.addAnimation(fadeIn);

but I want animation like "slide to unlock". I have searched a lot, cannot get my requirement.

Upvotes: 0

Views: 1483

Answers (2)

Android Geek
Android Geek

Reputation: 636

You can put content placeholder animation like Shimmer animation

enter image description here

Refer below link for shimmer effect code: https://www.androidhive.info/2018/01/android-content-placeholder-animation-like-facebook-using-shimmer/

Upvotes: 1

Ivan Wooll
Ivan Wooll

Reputation: 4323

You mean the 'Shimmer' effect? https://github.com/RomainPiel/Shimmer-android

Upvotes: 5

Related Questions