Android Use <merge> tags

Source: Internet
Author: User

<merge />Tags remove redundant viewgroup at the UI level when you nest Layout. For example, if you have a layout that is a vertical linearlayout that contains two consecutive view that can be reused in another layout, then you would do a linearlayout to include the two view for reuse. However, when using one linearlayout as the root node of another linearlayout, this nesting linearlayout does not make sense except to slow down your UI performance.

To avoid this situation, you can <merge> replace the root node of the reusable Layout with elements. For example:

<merge xmlns:android="http://schemas.android.com/apk/res/android"> <Button android:layout_width="fill_parent"Android:layout_height="wrap_content"Android:text="@string/add"/> <Button android:layout_width="fill_parent"Android:layout_height="wrap_content"Android:text="@string/delete"/></merge>

Now, when you want to include this layout in another layout (and use a <include/> label), the system ignores the <merge> label and puts two buttons directly into layout <include> is located.

Android Use <merge> tags

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.