互換性ライブラリの新しいViewPagerに基づいてアプリケーションを作成しようとしています。サンプルアプリケーションから行をコピーすると、次のようになります。
setContentView(R.layout.main);
MyAdapter mAdapter = new MyAdapter(getSupportFragmentManager(), this);
ViewPager mPager = (ViewPager) findViewById(R.id.view_pager);
mPager.setAdapter(mAdapter);
次のmain.xmlを使用します。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/view_pager"
/>
<LinearLayout>
私は
java.lang.ClassCastException: android.support.v4.app.NoSaveStateFrameLayout
ViewPagerにキャストした行で。なぜこれが起こっているのか誰かが知っていますか?