and extract them into a separate layout XMLresource,replacing them with an
<include>element.Just select the widget(s)youwanttoreuse, then right-clickover
them and choose “Extract Include” from thecontext menu. This will bring up a
dialogwhereyou can specify a nameto give the new layout XMLresource:
By default, the tools will search all your layout files for these widgets and replace
them with the<include>,though you can uncheck the check box to disable this
behavior and only affect the layout XML resource you are presently editing.
If you are extracting multiple widgets that are not wrapped in their own container,
Eclipse will automatically wrap them in a<merge>element:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<!-- widgets go here -->
</merge>
This is necessary purely from an XML standpoint—you cannot have multiple root
elements in an XML file.When the<merge>is addedto another layout via
<include>,the<merge>element itself evaporates, leaving behind its children.
wrap in container 改变布局
change widget type 改变控件类型