CT604A-N
Android Programming
Unit : 4 : Designing User Interfaces with Layouts
Data-Driven Containers
Adapters
Adapters
Adapters
Enumerated list
ListView of items
Organizing Screens with Tabs (Tab Layout)
Sequence Diagram
Entire Activity
Tab Layout
Tab Item
View Pager
Sequence Diagram
Fragment 1
Fragment 2
Fragment 3
View Pager
PageAdapter
extend
FragmentPageAdapter
Create a new Project
Step : 1 : Take Tab Layout
activity_main.xml
Design Section
Search TabLayout
Download TabLayout and add app dependancy
Go to its xml code
Change the layout to Linear Layout.
android : orientation = “vertical”
res
values
styles.xml
res
values
colors.xml
Step : 2 : activity_main.xml
Tablayout ID
Background Color of Tab
Text Color Within the Tab
Text Color of the selected Tab
Tab Indicator at bottom of the tab
Making of Tab Layout
Tab 1 ID
Making of Tab items
Text for Tab 1
Tab 2 ID
Text for Tab 2
Tab 3 ID
Text for Tab 3
Making of View Pager
ID of ViewPager
Making objects and reference
Object of tab layout
Object of tab items
Object of view pager
Reference of all
the objects
Making Page Adapter class
Errors
After implementation
of the methods
Constructor
Tab count to initialize the count of the tab
To return the tab count…
Make a switch to send which fragment is selcted
Making Fragments
new
Fragment
Fragment(blank)
Make 3 fragments having
name ftab1, ftab2 and ftab3
Making Fragments
Text which shows
in the fragment
Alignment
of the text
Color of the text
Size of the Text
Making Fragments
Cases of fragment to choose which fragment will be shown
Making Fragments
Making Fragments
To get current position of the fragment and notify
the fragment that your current position has been changed