Reputation: 61
here is my code, I try to slide screen in container activity, the full code is here
Container.groovy
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState)
setContentView(R.layout.container)
ViewPager pager = (ViewPager) findViewById(R.id.pager)
pager.setAdapter(new PagerAdapter(fragmentManager))
}
container.xml
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"/>
error:
Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class ViewPager
...
at ro.vst.Container.onCreate(Container.groovy:17)
Upvotes: 0
Views: 740
Reputation: 157447
I looked the code you posted on github and your container.xml has the following content:
<ViewPager
android:id="@+id/pager"
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"/>
The root should be <android.support.v4.view.ViewPager
and not <ViewPager
since ViewPager
exits only as part of the support library
Upvotes: 2