リストの下に表示したい広告があります。現在、それはリストを超えており、機能しています。コードは次のようになります。
<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
何が問題ですか?