我有一个广告,我想在我的列表下显示。目前它在列表中并且有效。代码如下所示:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<fragment android:name="xx.AdFragment"
android:id="@+id/ad_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ExpandableListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ExpandableListView>
</LinearLayout>
问题是,当我把它放在这样的列表下时:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<ExpandableListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ExpandableListView>
<fragment android:name="xx.AdFragment"
android:id="@+id/ad_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
应用程序崩溃,我收到错误:
10-29 12:35:56.288: E/AndroidRuntime(13712): FATAL EXCEPTION: main
10-29 12:35:56.288: E/AndroidRuntime(13712): java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx/xxx.MainActivity}: java.lang.ClassCastException: android.support.v4.app.NoSaveStateFrameLayout cannot be cast to android.widget.ExpandableListView
问题是什么?