Android Swiping Login and Register Page - a Playground


In the last post we already taken a look on how to get the Swiping pages using the viewpager with fragments.In this tutorial we are actually going to play with that and implement in creating a login and register pages using it.


Lets get Started  to it !

A FlashBack of what we actullay learn in the last tutorial.

What is View Pager and how do we use it?
ViewPager is most often used in conjunction with Fragment, which is a convenient way to supply and manage the lifecycle of each page. There are standard adapters implemented for using fragments with the ViewPager, which cover the most common use cases.
These are FragmentPagerAdapter and FragmentStatePagerAdapter; each of these classes have simple code showing how to build a full user interface with them.

PageAdapter

When you implement a PagerAdapter, you must override the following methods at minimum:

Lets get started  to it !

Step I: Creating the Layout File


A)Creating FragmentRegister.xml
Just add the code in your fragmentRegister.xml file in the layout folder.

Creating FragmentLogin.xml
Just add the code in your fragmentLogin.xml file in the layout folder.
Creating View_pager Layout
Just add the code in your View_pager.xml file in the layout folder.

Step 2:Creating the Fragment Java Code.

once the layout file is created you can add the Backend fragment code which will provide you with your required results.

FragmentLogin.java


FragmentRegister.java

PageAdapter.java

MainActivity.java



Thats the end of the tutorial You can run that in an emulator or your device.
If you have any doubts or suggestion comment below.In the next part we will see how to apply transition/animations to the fragments .

Thanks and Happy coding!

Alll the world is a laboratory to the inquiring mind! Join Us

Comments

Popular posts from this blog

A Deep Intro to Machine Learning(Python) - A Beginners Guide

Data visualization in python matplotlib with example

Pandas in Python for Data Analysis with Example(Step-by-Step guide)