Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Owner and Founder. Opencart
Top Partners
Uses of animations make your application more realistic, more attractive and easy to use. So in this blog, we are going to show you how to add basic animation in your Views to make it attractive by java code. Animations can add be notify users about what’s going on in your app and improve their thinking model of your app’s interface
This animation is of view translation with fade in and fade out effect on the view,
In xml,
<LinearLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="55dp" android:background="@color/background_color" /> 12345 <LinearLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="55dp" android:background="@color/background_color" />
In Java,
mBinding.toolbar.animate().translationY(-(mBinding.toolbar.getHeight()).setDuration(1000) .alpha(0.0f); 12 mBinding.toolbar.animate().translationY(-(mBinding.toolbar.getHeight()).setDuration(1000) .alpha(0.0f);
By above function, you can translate your view with fade out effect.
setDuration(1000)
alpha(0)
You can also add the listener to your animation that what you want to do before or after performing the animation.
mBinding.toolbar.animate().alpha(0.0f).translationY(0).setListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mBinding.toolbar.setVisibility(View.GONE); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); 123456789101112131415161718192021 mBinding.toolbar.animate().alpha(0.0f).translationY(0).setListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mBinding.toolbar.setVisibility(View.GONE); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { }});
Thanks for the reading this blog, if you have any doubt and query comment below.
Happy Coding and Stay Super.
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.
Osama
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.