0
時,我有一個崩潰(應用程序意外停止)這個main.xml中的問題是一個「HelloWorld」的類型項目(同時測試和學習功能,我需要爲我的應用程序):Android的崩潰調用的ImageButton
我隔離作爲的ImageButton一個問題,但我不能排除任何參數...
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageButton android:id="@+id/picture"
android:layout_width="240dip"
android:layout_height="180dip"
android:layout_gravity="center_horizontal"
android:src="@drawable/icon"
android:adjustViewBounds="true"
android:cropToPadding="true"
android:clickable="true"
android:scaleType="fitCenter" />
</LinearLayout>
的icon.png在我的資源存在...... 我可以看到預覽的佈局選項卡,即使圖像沒有集中在按鈕上,但我讀到這是正常的。
下面的代碼工作正常(作爲一個常規的按鈕)。我也可以像ImageView那樣做。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button android:id="@+id/picture"
android:layout_width="240dip"
android:layout_height="180dip"
android:layout_gravity="center_horizontal" />
</LinearLayout>
我使用Eclipse和AVD,和我所有的學習是在2.1(SDK 7級)來完成。 我無法在實際設備上測試應用程序,因爲我還沒有。
在此先感謝!
您需要在Eclipse中從LogCat視圖中發佈Java堆棧跟蹤。 – 2010-04-21 18:25:03