2013-10-13 22 views
0

這是XML文件。奇怪我的程序在執行setContentView之後立即退出。該logcat的表現也不過如此這個xml佈局文件有什麼問題嗎?爲什麼setContentView在加載這個文件後失敗並且應用程序關閉之後關閉

線程ID = 1個線程與

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


    <TextView android:id="@+id/SpeechResult" 
    android:layout_height="0dp" 
    android:layout_weight="1" 
    android:background="@drawable/rounded_edge" 
    android:padding="6dip" 
    android:hint="Waht is on your mind?"/> 

    <ToggleButton 
    android:id="@+id/ToggleRecognition" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom" 
    android:textOff="Start" 
    android:textOn="Stop" 
    android:onClick="onToggleRecognition"/> 

</LinearLayout> 

回答

1

我已經找到了好辦法未捕獲的異常(組= 0x417d)退出,真的很混亂,我認爲Eclipse應當在最少有一些調試信息,因爲這真的很吸引人。該問題與TextView中缺少的layout_width屬性有關。不知道爲什麼這會導致崩潰,但至少增加它使得maggice