If you are not read yet the part-06 blog then first of all you read and implement part-06 visit CLICK HERE.

In this blog, we can create a java code in Login Fragment which related to XML UI Layout means if you wanted to create a complete application then you must create it in the LoginFragment.java file. So you can follow step by step.

First, we create a variable to implement all layouts (EditText, TextView, Button, and flot) given below.

EditText email, password;
TextView forgotPassword;
Button loginButton;
float v = 0;

Now, we can initialize all variables given above under onCreateView methods.

email = root.findViewById(R.id.email_id);
password = root.findViewById(R.id.password);
forgotPassword = root.findViewById(R.id.forgotPassword);
loginButton = root.findViewById(R.id.loginButton);

Next, we can create an animation method with java code under the onCrreateView method for the slow-motion animation method.

So, first we can TranslationX method for animation.

email.setTranslationX(800);
password.setTranslationX(800);
forgotPassword.setTranslationX(800);
loginButton.setTranslationX(800);

Next, we can set Alpha Values.

email.setAlpha(v);
password.setAlpha(v);
forgotPassword.setAlpha(v);
loginButton.setAlpha(v);

Now, finally we can set time duration and time delay for given all layout.

email.animate().translationX(0).alpha(1).setDuration(800).setStartDelay(300).start();
password.animate().translationX(0).alpha(1).setDuration(800).setStartDelay(500).start();
forgotPassword.animate().translationX(0).alpha(1).setDuration(800).setStartDelay(500).start();
loginButton.animate().translationX(0).alpha(1).setDuration(800).setStartDelay(700).start();

And last, we create a closing root and breakers onCreateView method.

return root;
}

Now, the above code part-07 will be implemented Next part will be available CLICK HERE.


0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *