我正在尝试使用片段制作标签(按工厂使用内容)。在点击每个标签时,显示的内容是“带标签的内容:(标签)”。请指导我。
这是我的项目:http://www.filedropper.com/androiduxframework
这是我的logcat:
12-26 13:06:51.768: D/AndroidRuntime(485): Shutting down VM
12-26 13:06:51.778: W/dalvikvm(485): threadid=1: thread exiting with uncaught exception (group=0x40015560)
12-26 13:06:51.808: E/AndroidRuntime(485): FATAL EXCEPTION: main
12-26 13:06:51.808: E/AndroidRuntime(485): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androiduxframework.pragya/com.androiduxframework.pragya.FirstActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
12-26 13:06:51.808: E/AndroidRuntime(485): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.os.Handler.dispatchMessage(Handler.java:99)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.os.Looper.loop(Looper.java:123)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.app.ActivityThread.main(ActivityThread.java:3683)
12-26 13:06:51.808: E/AndroidRuntime(485): at java.lang.reflect.Method.invokeNative(Native Method)
12-26 13:06:51.808: E/AndroidRuntime(485): at java.lang.reflect.Method.invoke(Method.java:507)
12-26 13:06:51.808: E/AndroidRuntime(485): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-26 13:06:51.808: E/AndroidRuntime(485): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-26 13:06:51.808: E/AndroidRuntime(485): at dalvik.system.NativeStart.main(Native Method)
12-26 13:06:51.808: E/AndroidRuntime(485): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
12-26 13:06:51.808: E/AndroidRuntime(485): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
12-26 13:06:51.808: E/AndroidRuntime(485): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.app.Activity.setContentView(Activity.java:1657)
12-26 13:06:51.808: E/AndroidRuntime(485): at com.androiduxframework.pragya.FirstActivity.onCreate(FirstActivity.java:14)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
12-26 13:06:51.808: E/AndroidRuntime(485): ... 11 more
12-26 13:06:51.808: E/AndroidRuntime(485): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.androiduxframework.Tabs: make sure class name exists, is public, and has an empty constructor that is public
12-26 13:06:51.808: E/AndroidRuntime(485): at android.support.v4.app.Fragment.instantiate(Fragment.java:401)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.support.v4.app.Fragment.instantiate(Fragment.java:369)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
12-26 13:06:51.808: E/AndroidRuntime(485): ... 20 more
12-26 13:06:51.808: E/AndroidRuntime(485): Caused by: java.lang.ClassNotFoundException: com.androiduxframework.Tabs in loader dalvik.system.PathClassLoader[/data/app/com.androiduxframework.pragya-2.apk]
12-26 13:06:51.808: E/AndroidRuntime(485): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
12-26 13:06:51.808: E/AndroidRuntime(485): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
12-26 13:06:51.808: E/AndroidRuntime(485): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
12-26 13:06:51.808: E/AndroidRuntime(485): at android.support.v4.app.Fragment.instantiate(Fragment.java:391)
12-26 13:06:51.808: E/AndroidRuntime(485): ... 23 more
12-26 13:06:54.688: I/Process(485): Sending signal. PID: 485 SIG: 9
帮我纠正错误。 谢谢! :)