Presentation is loading. Please wait.

Presentation is loading. Please wait.

Depreciation App: Demo of tabs

Similar presentations


Presentation on theme: "Depreciation App: Demo of tabs"— Presentation transcript:

1 Depreciation App: Demo of tabs

2 Choose Tabbed Activity instead of usual Empty Activity

3 Choose Navigation Style: Action Bar Tabs

4 So far: moves from tab to tab – has email icon “floating” on each tab

5 To eliminate the floating button, find it in Layout and delete it

6 Find the floating button code in MainActivity and delete it as well

7 And voila – no pink email floating button thing

8 Right click on layout, choose new Layout resource

9 Name your new layout resource

10 For now just add something that will distinguish it from the automatic tab layout fragments

11 Add new java class: right click one level above MainActivity

12 Name your class

13 Add that the class “extends Fragment” and import Fragment
I imported the wrong version of Fragment and lost a lot of time

14 Right click and choose generate

15 Choose Override methods

16 Choose onCreateView

17 Use the inflater and connect to the desired layout you made previously

18 Go to res/values/strings.xml and change the tab names

19 Go to MainActivity, the getCount method determines the number of tabs

20 The tabs in activity_main
The tabs in activity_main.xml – but the text of the tabs is controlled by the strings.xml data

21 Adapt code to send user to your class when first tab is pressed

22 Result

23 In Fragment inflate the view but don’t return it right away instead to usual interface code
You cannot simply have findViewById() Now it’s myView.findViewById()


Download ppt "Depreciation App: Demo of tabs"

Similar presentations


Ads by Google