2

私のプログラム(実際には私のものではありません。このバグを修正しようとしているだけです)は、ほとんどの電話で正常に動作しますが、Sony Xperia Pでは起動しません。

プログラムを起動すると、次のメッセージが表示されます。

アプリケーションが予期せず停止しました。

アプリには、この携帯電話にはランチャー アイコンもありません (デフォルト アイコンのみ)。

エラーログには次のように書かれています:

java.lang.RuntimeException: unable to start Activity
android.view.InflateException: Binary XML file line #16: error inflating class android.view.ImageView

アプリが呼び出されたときにエラーメッセージが表示されました:

setContentView(R.layout.menu_0_splash);

ドローアブル リソースが次の解像度で定義されていることに気付きました。

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

この電話は 960x540 なので、デフォルトのリソースもあるはずです。

何が問題なのですか?

レイアウト ファイル (コピー/貼り付け):

<?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>
4

2 に答える 2

7

実際にログからエラーをコピーして貼り付けたと仮定すると、タイプミスがあります。

java.lang.RuntimeException: アクティビティ android.view.InflateException を開始できません: バイナリ XML ファイルの行 #16: クラス android.view.ImageVeiw の膨張エラー

ImageViewいずれかの layout.xml ファイルでスペルが間違っています。

于 2012-12-04T10:36:38.143 に答える
3

最後に、何が問題なのかわかりました...電話には特別な解像度 (960x540) があり、この解像度の ImageView-s のソース画像と寸法ファイルを見つけることができません。一般的な」解像度。

助けてくれてありがとう、+1で感謝します

于 2012-12-04T15:09:33.217 に答える