Android活动无法在某些设备上启动(错误充气类)

key*_*bee 2 android resolution sony runtimeexception inflate-exception

我的程序(实际上不是我的,我只是想修复这个错误)在大多数手机上运行正常,但它不能在索尼Xperia P上启动.

当我启动该程序时,会出现以下消息:

应用程序意外停止.

该应用程序在此手机上也没有启动器图标(仅限默认图标).

错误日志说:

java.lang.RuntimeException: unable to start Activity
android.view.InflateException: Binary XML file line #16: error inflating class android.view.ImageView
Run Code Online (Sandbox Code Playgroud)

应用程序调用时出现错误消息:

setContentView(R.layout.menu_0_splash);
Run Code Online (Sandbox Code Playgroud)

我注意到可绘制资源是针对以下分辨率定义的:

1024x600 320x240 400x240 480x320 800x480 854x480

这款手机的电话是960x540,所以我最好的问题是它也应该是dafault资源.

可能是什么问题呢?

布局文件(现在复制/粘贴-d):

<?xml version       = "1.0" 
encoding    = "utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/m0_relativeLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/gradient_green" >

<ImageView #this is the problematic line
    android:id="@+id/arrow_top"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="@dimen/m0_arrow_top_margintop"
    android:src="@drawable/splash_arrow_top" />

<ImageView
    android:id="@+id/arrow_bottom"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_marginBottom="@dimen/m0_arrow_bottom_marginbottom"
    android:src="@drawable/splash_arrow_bottom" />

<ImageView
    android:id="@+id/belt_top"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:src="@drawable/splash_belt_top" />

<ImageView
    android:id="@+id/belt_bottom"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:src="@drawable/splash_belt_bottom" />

<ImageView
    android:id="@+id/t_ad"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:adjustViewBounds="true"
    android:src="@drawable/t_ad" />

<ImageView
    android:id="@+id/title"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/t_ad"
    android:adjustViewBounds="true"
    android:src="@drawable/splash_title" />

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

Dav*_*ser 7

假设您实际上从日志中复制/粘贴了错误,那么您有一个错字:

java.lang.RuntimeException:无法启动Activity android.view.InflateException:二进制XML文件行#16:错误膨胀类android.view.ImageVeiw

ImageView 在您的一个layout.xml文件中拼写错误.