Android(安卓)Layout Tricks #2: Reusing layouts
Android comes with a wide variety of widgets, small visual construction blocks you can glue together to present the users with complex and useful interfaces. However applications often need higher level visual components. A component can be seen as a complex widget made of several simple stock widgets. You could for instance reuse a panel containing a progress bar and a cancel button, a panel containing two buttons (positive and negative actions), a panel with an icon, a title and a description, etc. Creating new components can be done easily by writing a custom View but it can be done even more easily using only XML.
In Android XML layout files, each tag is mapped to an actual class instance (the class is always a subclass of View.) The UI toolkit lets you also use three special tags that are not mapped to a View instance:
The
In the
This tag is particularly useful when you need to customize only part of your UI depending on the device's configuration. For instance, the main layout of your activity can be placed in the layout/ directory and can include another layout which exists in two flavors, in layout-land/ and layout-port/. This allows you to share most of the UI in portrait and landscape.
Like I mentioned earlier, my next post will explain the
原文出处:
Android Layout Tricks #2: Reusing layouts
更多相关文章
- android漂亮EditText效果、背景动画、NFC解析、开发工具、模板项
- 【Android(安卓)UI】如何做一个纯粹的Android(安卓)app UI 设计
- 网页中android Toast效果的实现
- cocos2dx android版本移植时的Error format not a string litera
- New Gingerbread API: StrictMode阅读笔记
- Android硬件渲染之LockCanvas()
- Android(安卓)软件自动更新功能实现的方法
- broadcastreceiver 静态注册无法正常运行
- Android(安卓)Listview多次调用相同的addHeaderView和addFooterV