android在布局xml文件中是否支持多个根 [英] Does android supports multiple roots in layout xml file
本文介绍了android在布局xml文件中是否支持多个根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在这里,我需要将这两个根结合起来....有可能吗??? 如果是,那怎么办???
Here I need to combine these two roots....is it possible??? If yes then how????
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"`
android:layout_width="match_parent"`
android:layout_height="match_parent"`
android:layout_gravity="center_vertical"`
android:gravity="center_vertical"`
android:orientation="vertical">`
</LinearLayout>`
<android.support.v4.widget.DrawerLayout`
xmlns:android="http://schemas.android.com/apk/res/android"`
android:id="@+id/drawer_layout"`
android:layout_width="match_parent"`
android:background="#ffffff"`
android:layout_height="match_parent">`
<ListView
android:id="@android:id/list"`
android:layout_width="240dp"`
android:layout_height="match_parent"`
android:layout_gravity="left"`
android:choiceMode="singleChoice"`
android:dividerHeight="1dp"`
android:clickable="true"`
android:background="@android:color/black"/>`
</`android.support.v4.widget.DrawerLayout`>`
推荐答案
XML标准不允许在xml文档中添加多个根元素.因此,我认为在XML标准不允许的情况下,任何与XML兼容的应用程序都不会支持多个根元素.
XML standard does not allow to add multiple root elements in xml document. So I do not think that any app which works with XML will support multiple root elements when it is not allowed by XML standard.
这篇关于android在布局xml文件中是否支持多个根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文