The following small series for you to introduce the relationship between fragment and activity. Need a friend to come over and refer to the next
Today we continue to explain the characteristics of the fragment component, primarily with the interaction of the activity and the lifecycle, as we have said earlier that fragment is dependent on activity and that the l
The use of Android fragment
1. Use Support Library
If your application needs to run in versions 3.0 and above, you can ignore this part of the content.
If your application uses a version below 3.0, 1.6, or more, you need to use a support library to build it.
To use the Support library:
1. Use the SDK Manager tool under the SDK to download the Android Support Package
2. Create a libs directory under the top-level directory of your Android project
people make a mistake and put the controls and data initialized in the Oncreateview, including me, which has been done before, This causes your fragment to reload the interface and data when you wake up again.Solution: onCreate () is called before Oncreateview (), so you initialize the view and data that you want to return in Oncreateview in OnCreate, Oncreateview is only responsible for returning a view of the interface. Try it out, I just found it
1. DefinitionFragment Chinese interpretation is the meaning of fragmentation, mainly used on large-screen devices, such as tablets, to support a more dynamic and flexible UI design. fragment is equivalent to a modular and reusable component in your application, because fragment defines its own layout and defines its own behavior by using its own lifecycle callback method, you can include
This article is a series of articles, I am in the long-distance development of Android a little thoughts and records, I will try to follow the first easy after the difficult sequence to write the series. The series cited the "Android Development art exploration" and "in-depth understanding of Android volume Ⅰ,ⅱ,ⅲ" in the relevant knowledge, in addition to learn from other high-quality blog, here to the great God to thank you, worship!!!ObjectiveThe previous article detailed analysis of
Fragment may have been my mind all the time, because Android development is not as systematic as the general process of learning, but rather directly in the company project to change the bug began. It was when fragment was brought up, when he put all his energy into the business logic of combing the code, and missed the fragment First Bus, which is now.
The
1.Fragment Overviewin an activity, fragment represents a part of the UI or an action. An activity can combine multiple fragment objects or different objects corresponding to the same fragment byte code in multiple activity. A fragment object must be embedded in a main activi
(Fragment layout is not set backgound)
Before about the concept of fragment in Android and how to create it, I wrote a blog post, "Explain the two ways to create Android fragment," and make a detailed analysis of how to create a fragment hybrid layout. Let's go into detail today about how
First, Fragment introduction
Fragment in 3.0 after the introduction of the project to use more and more Fragment, especially the main interface is the bottom tab click to switch the replacement content, of course, Fragment in the project exists a wide range of times, such as usually in the home page design, usually at
The preface has been learning Java and Android for nearly a year, and the result should be to independently complete an Android client "play the game" and ensure its stability in the mainline version. During the encounter a lot of pits, but also follow my brother learned a lot of Android knowledge. But people always want to embrace change, can not let themselves too comfortable, although there is not, but I have proved their ability to learn, the next step is to start to do ROM porting. Here's a
Original: Http://blog.csdn.net/shanxuyang/article/detailsActivity to fragment value1. The value to be passed is placed in the bundle object2. Pass the Bundle object through Setarguments () to fragment by creating a pass-through fragmentThe value of the bundle object can be obtained by getarguments () in 3.FragmentFragment the value of the activity1. Write a callback interface in the fragment2. Implement thi
Use of nested fragment and common errorsNested fragments (Nested fragments), fragment is added inside the fragment.When used, the main need to rely on the host fragment getChildFragmentManager() to obtain Fragmentmanger.While it looks similar to adding fragment in the activity, there are a few areas that require speci
Due to my limited English skills, please understand at the beginningThis blog is original as long as it does not indicate "Conversion". Please indicate the link for the post.
Android Fragment development documentation translation-1Android Fragment development documentation translation-2This series does not translate the original article 100% nor post the original article 100%.
[Android UI design and development] 4. Fragment introduction and simple implementation on the menu bar at the bottom (I), androidfragment
TabActivity has been completely deprecated since Android4.0 and replaced by Fragment. Fragment is a new concept in Android3.0. Fragment is translated into Chinese, which means fragme
Objective:Before the project, the use of this fragment, in the middle encountered a lot of pits, the pits are solved, and now write a simpler fragment use summaryA brief introduction to fragment:Simply put, fragment can actually be understood as a control with its own life cycle, except that the control is a bit special, it has its own ability to handle input eve
Reprint Please specify source: http://blog.csdn.net/guolin_blog/article/details/8881711 We all know that the interface display on Android is implemented through activity, activity is too often used, I believe we are already very familiar with, here will not repeat. But activity also has its limitations, the same interface on the phone may look good, on the tablet is not necessarily, because the tablet screen is very large, the phone's interface on the tablet may be excessively stretched, the con
Today we continue to explain the characteristics of the fragment component, primarily with the interaction of the activity and the lifecycle, as we have said earlier that fragment is dependent on activity and that the lifecycle is bound to the activity. Let's look at the relationship between fragment and activity.1. Create an event callback method for the activit
The main meaning of fragment is to provide a lifecycle callback that is bound to the activity.Fragment does not necessarily add view to the view level of the activity. When a module needs to obtain an activity's lifecycle callback, it can be considered by fragment.For example: Dialogfragment, call the Show method to display a dialog (this one is not in the view level of the activity), and when the screen is rotating, Dialogfragment uses Ondestroyview
Tags: des Android blog HTTP Io OS ar Java strong Interaction between fragment and Activity
An fragment instance is always directly related to the activity that contains it.
Fragment can be passed throughGetactivity ()Then you can call methods such as findviewbyid.
For example:
View listview =Getactivity ().Findviewbyid(R. Id. List );
Note that when getac
Use of nested fragment and common errorsNested fragments (Nested fragments), fragment is added inside the fragment.When used, the main need to rely on the host fragment getChildFragmentManager() to obtain Fragmentmanger.While it looks similar to adding fragment in the activity, there are a few areas that require specia
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.