2

我正在尝试扩展布局。它在较大的屏幕上运行良好。但是它在小屏幕上不起作用。我在日志上收到以下错误

它适用于nexus 7,LG。但不适用于三星Galaxy Y(2.7英寸)。

   **FATAL EXCEPTION: main
       android.view.InflateException: Binary XML file line #17: Error inflating class <unknown>
    at android.view.LayoutInflater.createView(LayoutInflater.java:518)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:332)
    at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
    at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:192)
    at android.view.View.measure(View.java:8313)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
    at android.view.View.measure(View.java:8313)
    at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:581)
    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:365)
    at android.view.View.measure(View.java:8313)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
    at android.view.View.measure(View.java:8313)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
    at android.view.View.measure(View.java:8313)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
    at android.view.View.measure(View.java:8313)
    at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:581)
    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:365)
    at android.view.View.measure(View.java:8313)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
    at android.view.View.measure(View.java:8313)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
    at android.view.View.measure(View.java:8313)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
    at android.view.View.measure(View.java:8313)
    at com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove.onMeasure(CustomViewAbove.java:456)
    at android.view.View.measure(View.java:8313)
    at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:581)
    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:365)
    at android.view.View.measure(View.java:8313)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
    at android.view.View.measure(View.java:8313)
    at android.view.ViewRoot.performTraversals(ViewRoot.java:847)
    at android.view.ViewRoot.handleMessage(ViewRoot.java:1867)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:130)
    at android.app.ActivityThread.main(ActivityThread.java:3687)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
    at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.reflect.InvocationTargetException
)   at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
at android.view.LayoutInflater.createView(LayoutInflater.java:505)
    ... 56 more
 Caused by: android.content.res.Resources$NotFoundException: Resource is not a**

我无法找到问题所在。

我的布局是:

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/White"
    android:orientation="vertical" >

    <com.android.utils.MyTextViewHead
        android:id="@+id/card_offer_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp"
        android:drawableLeft="@drawable/head_left"
        android:drawablePadding="5dp"
        android:text="@string/CARD_OFFERS"
        android:textSize="@dimen/large_text"
        android:gravity="center_vertical"
        android:layout_gravity="center_vertical"
        android:textStyle="bold" />

   <!--  <ProgressBar
        android:id="@+id/progressBar1"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" /> -->

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_margin="@dimen/sidearea_margin"
        android:background="@drawable/side_round"
        android:padding="@dimen/sidearea_padding" >

        <LinearLayout
            android:id="@+id/spin_l"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_margin="7dp"
            android:orientation="vertical" >

            <EditText
                android:id="@+id/editText_search"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_gravity="center_horizontal"
                android:background="@drawable/searchbox"
                android:ems="10"
                android:hint="@string/card_text_dfault"
                android:paddingLeft="10dp"
                android:singleLine="true" >
            </EditText>

            <Spinner
                android:id="@+id/spinner_theme"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="7dp"
                android:background="@drawable/dropdown"
               android:entries="@array/theme_array"
                android:prompt="@string/Theme" 
                />

            <Spinner
                android:id="@+id/spinner_category"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="7dp"
                   android:entries="@array/category_array"
                android:background="@drawable/dropdown"               
                android:prompt="@string/Category" />

            <Spinner
                android:id="@+id/spinner_emirate"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="7dp"
                   android:entries="@array/emirate_array"
                android:background="@drawable/dropdown"
                android:prompt="@string/Emirate" />

            <Spinner
                android:id="@+id/spinner_location"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="7dp"
                   android:entries="@array/location_array"
                android:background="@drawable/dropdown"               
                android:prompt="@string/Location" />
        </LinearLayout>

        <Button
            android:id="@+id/search_now_btn"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:background="@drawable/search_now_selecter" />
    </RelativeLayout>

</LinearLayout>
4

2 回答 2

1

它是您的主要错误:- 引起:android.content.res.Resources$NotFoundException:资源不是**

请检查您的可绘制文件夹中的资源。您的小型布局缺少一些资源。

要么您正在使用某种类型的小部件,这些小部件不支持低版本设备。

于 2013-10-18T10:59:50.647 回答
0

检查清单文件中的目标

<uses-sdk android:minSdkVersion="4" />
于 2013-10-18T10:56:34.740 回答