0

I want to use the following code snippet, please help me in understanding the given functions or suggest me online documentation that can I use.

view.animate().setDuration(2000).alpha(0)
        .withEndAction(new Runnable() {
          @Override
          public void run() {
            list.remove(item);
            adapter.notifyDataSetChanged();
            view.setAlpha(1);
          }
      });

what does function setDuration(2000) , .alpha(0) ,.alpha(1) and .withEndAction()

Adham
  • 63,550
  • 98
  • 229
  • 344

2 Answers2

2
  • setDuration(2000) sets the duration of the animation to 2000 milliseconds or 2 seconds
  • alpha(0) the view's alpha property will be animated to this value
  • withEndAction() means at the end of the animation the following action will take place

Have a look here (http://developer.android.com/reference/android/view/ViewPropertyAnimator.html)

Ken Wolf
  • 23,133
  • 6
  • 63
  • 84
  • can you please tell more about Runnable() and why its name is capitalized b'coz most of methods in java begins with small letter. @Ken Wolf – cammando Nov 19 '16 at 13:57
  • @NikhilBalyan Runnable is an Interface (so it's capitalised) and we are implementing it, see http://stackoverflow.com/a/5848516/833647 – Ken Wolf Nov 19 '16 at 14:47
0

check this post, you can understand better

http://developer.android.com/guide/topics/graphics/prop-animation.html

blganesh101
  • 3,647
  • 1
  • 24
  • 44