android.content.res.Resources $ NotFoundException仅在纵向视图中

时间:2014-03-16 20:55:55

标签: android android-layout exception android-orientation

我很困惑,因为我在纵向模式下运行此特定活动时会遇到此ResourcesNotFoundException。 这很奇怪,因为我在横向视图中对所有xml进行了复制粘贴,这有效。 我也尝试将布局文件放在" layout"文件夹,结果相同。

还尝试清理我的项目并删除R文件(之后自动生成)。 我现在无法想到任何其他事情,所以我希望有人能帮助我解决这个问题。

xlarge-port的xml-layout:

<RelativeLayout 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"
    tools:context=".CategoriesSettings" >

    <TextView
        android:id="@+id/categories_headline"
        android:layout_width="400dp"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="10dp"
        android:text="Nuværende kategorier"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:layout_marginBottom="20dp" />


    <TextView
        android:id="@+id/category_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/create_category"
        android:layout_alignRight="@+id/create_category"
        android:layout_alignTop="@+id/categories_linearlist"
        android:layout_marginTop="52dp"
        android:text="Titel"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <EditText
        android:id="@+id/edittext_category_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/category_title"
        android:layout_alignRight="@+id/category_title"
        android:layout_below="@+id/category_title"
        android:ems="10" >

        <requestFocus />
    </EditText>

    <TextView
        android:id="@+id/create_category"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/categories_headline"
        android:layout_alignBottom="@+id/categories_headline"
        android:layout_marginLeft="200dp"
        android:layout_toRightOf="@+id/categories_headline"
        android:text="Opret en ny kategori"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <Button
        android:id="@+id/btn_create_category"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/visible_category_checkbox"
        android:layout_alignRight="@+id/visible_category_checkbox"
        android:layout_below="@+id/visible_category_checkbox"
        android:layout_marginTop="48dp"
        android:text="Opret kategori"
        android:onClick="createCategory" />

    <CheckBox
        android:id="@+id/visible_category_checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/edittext_category_title"
        android:layout_alignRight="@+id/edittext_category_title"
        android:layout_below="@+id/edittext_category_title"
        android:layout_marginTop="26dp"
        android:checked="true"
        android:text="Kategori skal være synlig for kunder" />

    <ListView
        android:id="@+id/categories_linearlist"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/categories_headline"
        android:layout_alignRight="@+id/categories_headline"
        android:layout_below="@+id/categories_headline" >

    </ListView>

</RelativeLayout>

Logcat数据:

03-16 21:47:07.270: E/AndroidRuntime(11795): FATAL EXCEPTION: main
03-16 21:47:07.270: E/AndroidRuntime(11795): android.content.res.Resources$NotFoundException: Resource ID #0x7f030005
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.content.res.Resources.getValue(Resources.java:1014)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.content.res.Resources.loadXmlResourceParser(Resources.java:2139)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.content.res.Resources.getLayout(Resources.java:853)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at adapters.CategoryAdapter.getView(CategoryAdapter.java:48)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.widget.AbsListView.obtainView(AbsListView.java:2159)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.widget.ListView.measureHeightOfChildren(ListView.java:1246)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.widget.ListView.onMeasure(ListView.java:1158)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.View.measure(View.java:15518)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.widget.RelativeLayout.measureChild(RelativeLayout.java:666)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:477)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.View.measure(View.java:15518)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.View.measure(View.java:15518)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.View.measure(View.java:15518)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.View.measure(View.java:15518)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1887)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1102)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1278)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1002)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4400)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.Choreographer.doCallbacks(Choreographer.java:562)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.Choreographer.doFrame(Choreographer.java:532)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.os.Handler.handleCallback(Handler.java:725)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.os.Handler.dispatchMessage(Handler.java:92)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.os.Looper.loop(Looper.java:137)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at android.app.ActivityThread.main(ActivityThread.java:5041)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at java.lang.reflect.Method.invokeNative(Native Method)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at java.lang.reflect.Method.invoke(Method.java:511)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
03-16 21:47:07.270: E/AndroidRuntime(11795):    at dalvik.system.NativeStart.main(Native Method)

使用上述布局的java类将复制到以下pastebin:http://pastebin.com/V2nJnNNN

也许它可以用来隔离问题

0 个答案:

没有答案