我搜索了很多,但找不到这个问题的答案:有没有办法在 ViewPager 下方使用 TitlePageIndicator?
我在 .xml 中尝试了相反的顺序,但得到了:
04-24 19:30:30.288: E/AndroidRuntime(3338): FATAL EXCEPTION: main
04-24 19:30:30.288: E/AndroidRuntime(3338): java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.totvs.android/br.com.totvs.android.ecm.activity.TelaPrincipalActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class fragment
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.os.Looper.loop(Looper.java:130)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-24 19:30:30.288: E/AndroidRuntime(3338): at java.lang.reflect.Method.invokeNative(Native Method)
04-24 19:30:30.288: E/AndroidRuntime(3338): at java.lang.reflect.Method.invoke(Method.java:507)
04-24 19:30:30.288: E/AndroidRuntime(3338): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-24 19:30:30.288: E/AndroidRuntime(3338): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-24 19:30:30.288: E/AndroidRuntime(3338): at dalvik.system.NativeStart.main(Native Method)
04-24 19:30:30.288: E/AndroidRuntime(3338): Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class fragment
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-24 19:30:30.288: E/AndroidRuntime(3338): at br.com.totvs.android.ecm.activity.TelaPrincipalActivity.onCreate(TelaPrincipalActivity.java:56)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-24 19:30:30.288: E/AndroidRuntime(3338): ... 11 more
04-24 19:30:30.288: E/AndroidRuntime(3338): Caused by: java.lang.ClassCastException: com.viewpagerindicator.TitlePageIndicator
04-24 19:30:30.288: E/AndroidRuntime(3338): at br.com.totvs.android.ecm.fragment.TabFragment.onCreateView(TabFragment.java:36)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:845)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1058)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1156)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:270)
04-24 19:30:30.288: E/AndroidRuntime(3338): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
04-24 19:30:30.288: E/AndroidRuntime(3338): ... 18 more
提前致谢,