-1
我试图构建一个tabhost编码,并将其卡在.xml部分中。解析XML时出错:文档元素后出现垃圾,tabhost编码出错
这里有以下activity_main.xml中
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pager"
android:layout_width="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity" />
<android.support.v4.app.FragmentTabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="horizontal" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</android.support.v4.app.FragmentTabHost>
有谁知道在此版本中的问题?
消息“错误:(8)错误解析XML:垃圾文档元素之后”出现从线7。 希望有人会知道这个问题,并可以帮助我,非常感谢你......!
放父布局 – Rustam
设置一个根以上Viewpager布局,像相对或线性 –
您看起来在这里有两个根元素 - “ViewPager”和“FragmentTabHost”。这是无效的。你的意思是'FragmentTabHost'元素在ViewPager元素里面吗? –