您的位置:首页 > 其它

为何要使用<merge\>标签

2012-03-05 14:06 721 查看
在使用include复用layout时,可能复用的layout有个view group,然后这个view group又被嵌套别的view group里,这样就增加了view的深度,影响运行的速度,而这种嵌套不是必须的。

因此可以使用<merge\>标签,它将它里面嵌套的view直接include到其父layout中,而没有再加一层view group,因此减小了深度,提高了速度

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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: