Usage analysis of include control in Android Development

This article describes the use of include control in Android development. Share with you for your reference, as follows:

We know that interface design is very important for the development of applications based on Android system, which is related to the user experience. A good interface design can't be done with an XML layout. When there are many controls in an activity and all the layout files are placed in one XML file, it's easy to imagine how bad it is! Through my own experience, the author uses the include control to solve this problem. The following is a small example. It only realizes the layout without responding to the design of code.

user. The contents of the XML file are as follows:

passwd. The contents of the XML file are as follows:

login. The contents of the XML file are as follows:

main. The contents of the XML file are as follows:

The running results of the program are as follows:

If in main The XML reads as follows:

Then the operation results in this case are as follows:

Obviously, the running results are not as expected. The next four controls can't come out. Why? (you must have encountered this problem when doing experiments!)

In fact, the key point is the layout of each XML in the main file. There is no corresponding layout, and the result is very miserable. You can modify the corresponding layout according to my code and realize the importance of the layout in main!

For more Android related content, readers who are interested can view the topics on this site: summary of Android view skills, summary of Android graphics and image processing skills, introduction and advanced tutorial of Android development, summary of Android debugging skills and solutions to common problems, summary of Android multimedia operation skills (audio, video, recording, etc.) Usage Summary of Android basic components, Android layout skills summary and Android control usage summary

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>