扩展类frameLayout时出错

时间:2013-06-16 21:06:33

标签: android android-layout

我正在创建一个应用程序,但我遇到了一个我似乎无法修复的错误。堆栈跟踪是:

06-16 20:58:21.568: W/dalvikvm(10648): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
06-16 20:58:21.608: E/AndroidRuntime(10648): FATAL EXCEPTION: main
06-16 20:58:21.608: E/AndroidRuntime(10648): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.unrealonline.timesheet/com.unrealonline.timesheet.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class frameLayout
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.os.Looper.loop(Looper.java:137)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.app.ActivityThread.main(ActivityThread.java:5041)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at java.lang.reflect.Method.invokeNative(Native Method)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at java.lang.reflect.Method.invoke(Method.java:511)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at dalvik.system.NativeStart.main(Native Method)
06-16 20:58:21.608: E/AndroidRuntime(10648): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class frameLayout
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.app.Activity.setContentView(Activity.java:1881)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at com.unrealonline.timesheet.MainActivity.onCreate(MainActivity.java:24)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.app.Activity.performCreate(Activity.java:5104)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
06-16 20:58:21.608: E/AndroidRuntime(10648):    ... 11 more
06-16 20:58:21.608: E/AndroidRuntime(10648): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.frameLayout" on path: /data/app/com.unrealonline.timesheet-1.apk
06-16 20:58:21.608: E/AndroidRuntime(10648):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.view.LayoutInflater.createView(LayoutInflater.java:552)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:643)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
06-16 20:58:21.608: E/AndroidRuntime(10648):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
06-16 20:58:21.608: E/AndroidRuntime(10648):    ... 20 more

我的main.xml是

<frameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:id="@+id/layout1"
        tools:context=".MainActivity" >
        <EditText
            android:id="@+id/username"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:ems="10"
            android:hint="@string/hints_username"
            android:inputType="textNoSuggestions"
            android:textAllCaps="false" />

        <EditText
            android:id="@+id/password"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/username"
            android:ems="10"
            android:hint="@string/hints_password"
            android:inputType="textPassword" />

        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/password"
            android:text="@string/buttons_text_login" />

    </RelativeLayout>
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:id="@+id/layout2"
        tools:context=".MainActivity" >

        <Button
            android:id="@+id/clockin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:text="@string/buttons_text_checkin" />

        <Button
            android:id="@+id/clockout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/clockin"
            android:text="@string/buttons_text_checkout" />

    </RelativeLayout>
</frameLayout>

我尝试过像“清理项目”这样的建议,但它们似乎没有用。我似乎无法弄清楚它有什么问题。

如果您需要任何其他详细信息,请随时提出。

1 个答案:

答案 0 :(得分:6)

<frameLayout>更改为<FrameLayout>(注意大写的第一个字母)并且必然会出现