After completing the development of Geoquiz application, we have a preliminary understanding of the development of Andriod, in which the most important thing for me is the application of MVC design template, the application of this design template greatly simplifies the complex and difficult to understand application. Next, we will increase the difficulty on the basis of some, design a more tall application.
We are designing an application called criminalintent, which can be used to document the bad habits of various offices in detail. Criminalintent app records include titles, dates, photos, etc. to support finding parties in contacts. It can be said that this application is really very practical.
This app wants to do the trouble of comparison, so I'll talk about this in the seventh chapter to the 13th chapter, the knowledge I have learned, and a general overview of this knowledge.
First of all, I will give you a look at this criminalintent application completed application interface bar!
to complete this application first we will refer to two things that have never been heard, they are UI fragment and fragment. Let me give you a detailed introduction to these two managers. (These two things are still very important, so I am here in detail, easy to understand, but also let oneself deepen the impression O (* ̄▽ ̄*) ブ)
fragment is a controller object that the activity can delegate to accomplish some tasks. These tasks are typically administrative user interfaces. The managed user interface can be part of a full screen or a full screen.
· UI fragment refers to the fragment of the management interface. It also has a view that is generated from the layout file itself.
· The fragment view contains visual UI elements that users can interact with. The Activity view can reserve a location for the fragment view to be inserted. If you have more than one fragment to insert, the activity view can also provide multiple locations. Depending on the needs of the application and the user, the user interface can be assembled or reassembled using fragment and activity together.
· Fragment's design does not require you to personally manage the complex changes in view hierarchy, by dispersing the activity's layout into frament, you can modify the appearance of the activity at run time, and save in the activity management back stack Some changes. When a fragment specifies its own layout, it can be configured in a different combination with the other clips, modifying the layout configuration for different screen sizes in the activity (the small screen may show one clip at a time, while a large screen can show two or more).
Fragment must be written as a reusable module. Because fragment has its own layout, responds to events, has its own life cycle and behavior, you can include different instances of the same fragment in multiple activities. This is especially important for making your interface a perfect experience for users with different screen sizes.
· Activity provides a place in its view level for placing fragment views, as shown in. The fragment itself does not have the ability to display views on the screen. Therefore, the fragment view can be displayed on the screen only if its view is placed in the activity's view hierarchy.
the Life cycle of fragment
1. When a fragment is created, it goes through the following states:
Onattach ()
OnCreate ()
Oncreateview ()
Onactivitycreated ()
2. When the fragment is visible to the user, it will experience the following States.
OnStart ()
Onresume ()
3. When this fragment enters "background mode", it will experience the following status.
OnPause ()
OnStop ()
4. When the fragment is destroyed (or the activity that holds it is destroyed), it goes through the following States.
OnPause ()
OnStop ()
Ondestroyview ()
Ondetach ()
5. Just like Activitie, in the following States, you can use the bundle object to save an fragment object.
OnCreate ()
Oncreateview ()
Onactivitycreated ()
Most of the 6.fragments state is similar to Activitie, but fragment has some new states.
Onattached ()--this method is called when fragment is associated with the activity.
Oncreateview ()-this method is called when creating a view in the fragment.
Onactivitycreated ()--this method is called when the activity's OnCreate () method is returned.
Ondestroyview ()-this method is called when the view in the fragment is removed.
Ondetach ()--this method is called when fragment and activity are separated.
An example test method for fragment life cycle
Some knowledge of Viewpager
Introduction and role of 1.ViewPager
Viewpager is the class in the Android Expansion Pack V4 package that allows the user to toggle the current view around
(1) The Viewpager class inherits directly from the ViewGroup class, all of which is a container class where additional view classes can be added.
(2) The Viewpager class requires a Pageradapter adapter class to provide it with data.
(3) Viewpager is often used in conjunction with fragment and provides specialized fragmentpageradapter and Fragmentstatepageradapter classes for fragment use in Viewpager.
2.ViewPager
——— This is the new knowledge I've learned in the last two weeks, and hopefully it will help people who don't know much about Android!
Android Knowledge Summary (2)