我正在尝试在Android应用的屏幕之间切换。第一个屏幕加载完美,但不是加载下一个屏幕,应用程序崩溃,我得到消息说应用程序已停止。我浏览了logcat并看到了ResourceNotFoundException错误。关于如何修复此错误的任何评论?
这是我的主要课程
public class MainActivity extends Activity {
/** Called when activity is first created. */
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Handler x = new Handler();
x.postDelayed(new SplashHandler(), 5000);
}
class SplashHandler implements Runnable{
public void run(){
Intent myIntent = new Intent(MainActivity.this, Main.class);
startActivity(myIntent);
}
}
}
这是下一个屏幕的课程
public class Main extends Activity{
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
第一个xml文件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#393131" >
<ImageView
android:id="@+id/museum_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/museum_logo" />
</RelativeLayout>
第二个xml文件
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@style/AppBaseTheme"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/scan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/scan" />
<ImageButton
android:id="@+id/manual"
android:layout_width="120dp"
android:layout_height="match_parent"
android:src="@drawable/manual" />
<ImageButton
android:id="@+id/history"
android:layout_width="109dp"
android:layout_height="wrap_content"
android:src="@drawable/history" />
</AbsoluteLayout>
清单文件,
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.museumapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="@string/app_name" android:name="Main">
</activity>
</application>
log cat
11-23 11:43:54.954: I/ActivityManager(15232): Timeline: Activity_launch_request id:com.example.museumapp time:5745841
11-23 11:43:54.974: D/AndroidRuntime(15232): Shutting down VM
11-23 11:43:54.974: W/dalvikvm(15232): threadid=1: thread exiting with uncaught exception (group=0x42026d88)
11-23 11:43:55.004: E/AndroidRuntime(15232): FATAL EXCEPTION: main
11-23 11:43:55.004: E/AndroidRuntime(15232): Process: com.example.museumapp, PID: 15232
11-23 11:43:55.004: E/AndroidRuntime(15232): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.museumapp/com.example.museumapp.Main}: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.AbsoluteLayout
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2237)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.app.ActivityThread.access$800(ActivityThread.java:144)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.os.Handler.dispatchMessage(Handler.java:102)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.os.Looper.loop(Looper.java:212)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.app.ActivityThread.main(ActivityThread.java:5135)
11-23 11:43:55.004: E/AndroidRuntime(15232): at java.lang.reflect.Method.invokeNative(Native Method)
11-23 11:43:55.004: E/AndroidRuntime(15232): at java.lang.reflect.Method.invoke(Method.java:515)
11-23 11:43:55.004: E/AndroidRuntime(15232): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
11-23 11:43:55.004: E/AndroidRuntime(15232): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
11-23 11:43:55.004: E/AndroidRuntime(15232): at dalvik.system.NativeStart.main(Native Method)
11-23 11:43:55.004: E/AndroidRuntime(15232): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.AbsoluteLayout
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.view.LayoutInflater.createView(LayoutInflater.java:620)
11-23 11:43:55.004: E/AndroidRuntime(15232): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
11-23 11:43:55.004: E/AndroidRuntime(15232): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:297)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.app.Activity.setContentView(Activity.java:1929)
11-23 11:43:55.004: E/AndroidRuntime(15232): at com.example.museumapp.Main.onCreate(Main.java:9)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.app.Activity.performCreate(Activity.java:5231)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
11-23 11:43:55.004: E/AndroidRuntime(15232): ... 11 more
11-23 11:43:55.004: E/AndroidRuntime(15232): Caused by: java.lang.reflect.InvocationTargetException
11-23 11:43:55.004: E/AndroidRuntime(15232): at java.lang.reflect.Constructor.constructNative(Native Method)
11-23 11:43:55.004: E/AndroidRuntime(15232): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.view.LayoutInflater.createView(LayoutInflater.java:594)
11-23 11:43:55.004: E/AndroidRuntime(15232): ... 23 more
11-23 11:43:55.004: E/AndroidRuntime(15232): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f0b008b a=-1 r=0x7f0b008b}
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.content.res.Resources.loadDrawable(Resources.java:2087)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.view.View.<init>(View.java:3685)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.view.View.<init>(View.java:3615)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.view.ViewGroup.<init>(ViewGroup.java:464)
11-23 11:43:55.004: E/AndroidRuntime(15232): at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:47)
11-23 11:43:55.004: E/AndroidRuntime(15232): ... 26 more
11-23 11:48:55.056: I/Process(15232): Sending signal. PID: 15232 SIG: 9
11-23 12:07:46.180: D/dalvikvm(16221): GC_FOR_ALLOC freed 56K, 15% free 50538K/58952K, paused 22ms, total 23ms
11-23 12:07:46.300: I/dalvikvm-heap(16221): Grow heap (frag case) to 99.712MB for 51948016-byte allocation
11-23 12:07:46.400: I/Adreno-EGL(16221): <qeglDrvAPI_eglInitialize:381>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_KK_2.7_RB1.04.04.04.007.064_msm8960_KK_2.7_RB1__release_AU ()
11-23 12:07:46.400: I/Adreno-EGL(16221): OpenGL ES Shader Compiler Version: 17.01.12.SPL
11-23 12:07:46.400: I/Adreno-EGL(16221): Build Date: 07/01/14 Tue
11-23 12:07:46.400: I/Adreno-EGL(16221): Local Branch:
11-23 12:07:46.400: I/Adreno-EGL(16221): Remote Branch: quic/kk_2.7_rb1.41
11-23 12:07:46.400: I/Adreno-EGL(16221): Local Patches: NONE
11-23 12:07:46.400: I/Adreno-EGL(16221): Reconstruct Branch: AU_LINUX_ANDROID_KK_2.7_RB1.04.04.04.007.064 + NOTHING
11-23 12:07:46.460: D/OpenGLRenderer(16221): Enabling debug mode 0
11-23 12:07:47.221: I/ActivityManager(16221): Timeline: Activity_idle id: android.os.BinderProxy@451b7e60 time:7178105
11-23 12:07:50.124: I/ActivityManager(16221): Timeline: Activity_idle id: android.os.BinderProxy@451b7e60 time:7181014
11-23 12:07:51.365: I/ActivityManager(16221): Timeline: Activity_launch_request id:com.example.museumapp time:7182259
11-23 12:07:51.405: D/AndroidRuntime(16221): Shutting down VM
11-23 12:07:51.405: W/dalvikvm(16221): threadid=1: thread exiting with uncaught exception (group=0x42026d88)
11-23 12:07:51.435: E/AndroidRuntime(16221): FATAL EXCEPTION: main
11-23 12:07:51.435: E/AndroidRuntime(16221): Process: com.example.museumapp, PID: 16221
11-23 12:07:51.435: E/AndroidRuntime(16221): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.museumapp/com.example.museumapp.Main}: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.AbsoluteLayout
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2237)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.app.ActivityThread.access$800(ActivityThread.java:144)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.os.Handler.dispatchMessage(Handler.java:102)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.os.Looper.loop(Looper.java:212)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.app.ActivityThread.main(ActivityThread.java:5135)
11-23 12:07:51.435: E/AndroidRuntime(16221): at java.lang.reflect.Method.invokeNative(Native Method)
11-23 12:07:51.435: E/AndroidRuntime(16221): at java.lang.reflect.Method.invoke(Method.java:515)
11-23 12:07:51.435: E/AndroidRuntime(16221): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
11-23 12:07:51.435: E/AndroidRuntime(16221): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
11-23 12:07:51.435: E/AndroidRuntime(16221): at dalvik.system.NativeStart.main(Native Method)
11-23 12:07:51.435: E/AndroidRuntime(16221): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.AbsoluteLayout
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.view.LayoutInflater.createView(LayoutInflater.java:620)
11-23 12:07:51.435: E/AndroidRuntime(16221): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
11-23 12:07:51.435: E/AndroidRuntime(16221): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:297)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.app.Activity.setContentView(Activity.java:1929)
11-23 12:07:51.435: E/AndroidRuntime(16221): at com.example.museumapp.Main.onCreate(Main.java:9)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.app.Activity.performCreate(Activity.java:5231)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
11-23 12:07:51.435: E/AndroidRuntime(16221): ... 11 more
11-23 12:07:51.435: E/AndroidRuntime(16221): Caused by: java.lang.reflect.InvocationTargetException
11-23 12:07:51.435: E/AndroidRuntime(16221): at java.lang.reflect.Constructor.constructNative(Native Method)
11-23 12:07:51.435: E/AndroidRuntime(16221): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.view.LayoutInflater.createView(LayoutInflater.java:594)
11-23 12:07:51.435: E/AndroidRuntime(16221): ... 23 more
11-23 12:07:51.435: E/AndroidRuntime(16221): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f0b008b a=-1 r=0x7f0b008b}
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.content.res.Resources.loadDrawable(Resources.java:2087)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.view.View.<init>(View.java:3685)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.view.View.<init>(View.java:3615)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.view.ViewGroup.<init>(ViewGroup.java:464)
11-23 12:07:51.435: E/AndroidRuntime(16221): at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:47)
11-23 12:07:51.435: E/AndroidRuntime(16221): ... 26 more
11-23 12:07:54.288: I/Process(16221): Sending signal. PID: 16221 SIG: 9
11-23 12:09:10.122: D/dalvikvm(17086): GC_FOR_ALLOC freed 68K, 15% free 50538K/58952K, paused 33ms, total 33ms
11-23 12:09:10.262: I/dalvikvm-heap(17086): Grow heap (frag case) to 99.712MB for 51948016-byte allocation
11-23 12:09:10.382: I/Adreno-EGL(17086): <qeglDrvAPI_eglInitialize:381>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_KK_2.7_RB1.04.04.04.007.064_msm8960_KK_2.7_RB1__release_AU ()
11-23 12:09:10.382: I/Adreno-EGL(17086): OpenGL ES Shader Compiler Version: 17.01.12.SPL
11-23 12:09:10.382: I/Adreno-EGL(17086): Build Date: 07/01/14 Tue
11-23 12:09:10.382: I/Adreno-EGL(17086): Local Branch:
11-23 12:09:10.382: I/Adreno-EGL(17086): Remote Branch: quic/kk_2.7_rb1.41
11-23 12:09:10.382: I/Adreno-EGL(17086): Local Patches: NONE
11-23 12:09:10.382: I/Adreno-EGL(17086): Reconstruct Branch: AU_LINUX_ANDROID_KK_2.7_RB1.04.04.04.007.064 + NOTHING
11-23 12:09:10.442: D/OpenGLRenderer(17086): Enabling debug mode 0
11-23 12:09:10.672: I/ActivityManager(17086): Timeline: Activity_idle id: android.os.BinderProxy@451baea8 time:7261563
11-23 12:09:15.357: I/ActivityManager(17086): Timeline: Activity_launch_request id:com.example.museumapp time:7266241
11-23 12:09:15.417: D/AndroidRuntime(17086): Shutting down VM
11-23 12:09:15.417: W/dalvikvm(17086): threadid=1: thread exiting with uncaught exception (group=0x42026d88)
11-23 12:09:15.457: E/AndroidRuntime(17086): FATAL EXCEPTION: main
11-23 12:09:15.457: E/AndroidRuntime(17086): Process: com.example.museumapp, PID: 17086
11-23 12:09:15.457: E/AndroidRuntime(17086): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.museumapp/com.example.museumapp.Main}: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.AbsoluteLayout
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2237)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.app.ActivityThread.access$800(ActivityThread.java:144)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.os.Handler.dispatchMessage(Handler.java:102)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.os.Looper.loop(Looper.java:212)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.app.ActivityThread.main(ActivityThread.java:5135)
11-23 12:09:15.457: E/AndroidRuntime(17086): at java.lang.reflect.Method.invokeNative(Native Method)
11-23 12:09:15.457: E/AndroidRuntime(17086): at java.lang.reflect.Method.invoke(Method.java:515)
11-23 12:09:15.457: E/AndroidRuntime(17086): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
11-23 12:09:15.457: E/AndroidRuntime(17086): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
11-23 12:09:15.457: E/AndroidRuntime(17086): at dalvik.system.NativeStart.main(Native Method)
11-23 12:09:15.457: E/AndroidRuntime(17086): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.AbsoluteLayout
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.view.LayoutInflater.createView(LayoutInflater.java:620)
11-23 12:09:15.457: E/AndroidRuntime(17086): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
11-23 12:09:15.457: E/AndroidRuntime(17086): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:297)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.app.Activity.setContentView(Activity.java:1929)
11-23 12:09:15.457: E/AndroidRuntime(17086): at com.example.museumapp.Main.onCreate(Main.java:9)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.app.Activity.performCreate(Activity.java:5231)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
11-23 12:09:15.457: E/AndroidRuntime(17086): ... 11 more
11-23 12:09:15.457: E/AndroidRuntime(17086): Caused by: java.lang.reflect.InvocationTargetException
11-23 12:09:15.457: E/AndroidRuntime(17086): at java.lang.reflect.Constructor.constructNative(Native Method)
11-23 12:09:15.457: E/AndroidRuntime(17086): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.view.LayoutInflater.createView(LayoutInflater.java:594)
11-23 12:09:15.457: E/AndroidRuntime(17086): ... 23 more
11-23 12:09:15.457: E/AndroidRuntime(17086): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f0b008b a=-1 r=0x7f0b008b}
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.content.res.Resources.loadDrawable(Resources.java:2087)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.view.View.<init>(View.java:3685)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.view.View.<init>(View.java:3615)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.view.ViewGroup.<init>(ViewGroup.java:464)
11-23 12:09:15.457: E/AndroidRuntime(17086): at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:47)
11-23 12:09:15.457: E/AndroidRuntime(17086): ... 26 more
答案 0 :(得分:1)
在清单变更中
<activity android:label="@string/app_name" android:name="Main">
与
<activity android:label="@string/app_name" android:name=".Main">
我在.
Main
<强>更新强>
删除第二个xml(main.xml)
中AbsoluteLayout的背景属性android:background="@style/AppBaseTheme"
答案 1 :(得分:1)
问题出在您的第二个xml文件中。仔细阅读堆栈跟踪,可以找到:
android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.AbsoluteLayout
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path)
这是由这一行引起的:
android:background="@style/AppBaseTheme"
您不能将样式资源用作背景,您需要提供颜色或可绘制资源(例如@android:color / white或@ drawable / your_drawable)。或者,您可以在styles.xml中定义背景,并使用AbsoluteLayout上的样式,如下所示:
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AppBaseTheme"
android:orientation="horizontal" >