Having introduced so many abstract things, it is time to learn the specific usage of fragments. Therefore, a better design solution is to put the news headline list interface and the news detailed content interface in two pieces respectively Then, the two fragments are introduced in the same activity so that the screen space can be fully utilized, as shown in the figure As shown in figure3. However, if you design the same on the tablet, the news headline list will be stretched to fill the entire tablet The title of the news is generally not too long, which will result in a lot of blank areas on the interface, as shown in Figure2. If it is designed in a mobile phone, we can put the news headline list in one activity, but the details of the news in another activity, as shown in Figure1. When one of the headlines is clicked, Open another interface to display the detailed content of the news. #Android studio fragment callback how toSo how to use the fragments to make full use of the space of the tablet screen? Imagine we are developing a News application, one of the interfaces uses ListView to display a set of news headlines. You can even understand the fragments as a mini activity, although these mini Activities may be as big as normal activities. Although fragmentation should be a brand new concept to you Read, I believe you should have no effort to learn, because it is so similar to activities, it can also contain layout, It also has its own life cycle. Experience the life cycle of Android Fragments:Īndroid Fragments:- Fragment is a UI fragment that can be embedded in the activity, it can make the program more reasonable and sufficient Utilize the space of the large screen, so it is widely used on the tablet.Communication between Android Fragments and activities:.Simulate the return stack in the fragment:.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |