HOW TO CREATE ANDROID TABLAYOUT VIEW PAGER FRAGAMENT ? - computer and printer 5

Header Ads

HOW TO CREATE ANDROID TABLAYOUT VIEW PAGER FRAGAMENT ?

HOW TO CREATE ANDROID TABLAYOUT VIEW PAGER FRAGMENT?


Hello, friends, I am gour. This blog Title we will learn Tab layout with your Android application. Now you go to the Android Studio. Now friends you create your Android studio project. you name it
you projet any name.after that next and chose the TabActivity. after that chose the next and now Actionbar Tab now finish. now loading your project Android Studio. Now friends you run your project genymotion  virtual device. just like image.

Friends, you can see the Three Tab and Floting ActionButton. Friends First I remove FlotingAction Button. Now you go to Activity_Main.xml click and open it.and removed your flotingActoin button tag. Then go to your java class MainActivaty click and open it. remove your floteingAction button.
Now you Create a separate layout file.Android  project layout folder right mouse click and create layout Resource file . name it you want. root element is RelativeLayout
Then ok. Now open layout file yoiu textView show  it . DFrope your TextView and name text you
any want. After that you copy and Two Resource files.name other you any want it.friends then create
Fragment Java Class. Now Click the Right Mouse and create the java class.you name it you want  it.

open your java class now extend fragment. just like image
Then Right Mouse click and generate the override method select OnecreateView(inflater:layout inflater,contaner) chose this.


 return  Inflater.inflate(R.layout.tab1,copntaner,false);


now copy your java class two times name it you want it. just change your inflate tab layout container. Now go to the MainActivaty click and open it. find the adapter class you delete the get item.


now

            swith  (position){
                                          case: 0;
                                       
                                      Tab1 tab1= new Tab1();

                                          return tab1;

                                      case: 1;
                                       
                                      Tab2 tab2= new Tab2();

                                          return tab2;
                                        case: 2;
                                       
                                      Tab3 tab3= new Tab3();

                                          return tab3;}

Now friends you run your app you look like you 3 fragme nt tab. thnks reading.
































No comments

Theme images by mammamaart. Powered by Blogger.