2

UPDATE____Android的佈局問題..不知道如何調試

logcat的輸出http://pastie.org/2039452

我的應用程序停止在調試器,然後墜毀在這條線,但很奇怪,因爲它沒有錯誤信息只是一個綠色箭頭是這樣的...

什麼這個箭頭一般是指任何有識之士將不勝感激...

enter image description here

這裏是LayoutStudentList

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" android:layout_height="fill_parent" 
    > 
    <TextView 
    android:id="@+id/studentHeader" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:padding="10dp" 
    android:textSize="16sp" 
    android:text="@string/StudentListHeader" 
    android:layout_alignParentTop="true" 
    /> 
    <EditText 
    android:id="@+id/studentSearch" 
    android:layout_width="fill_parent" 
    android:layout_below="@id/studentHeader" 
    android:padding="10dp" 
    android:textSize="12sp" 
    android:editable="true" 
    android:hint="@string/StudentFilterPlaceholder" 
    /> 
    <ListView 
     android:id="@+id/studentListView" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/studentSearch" 
     android:padding="10dp" 
    /> 
</RelativeLayout> 

的問題是幾乎可以肯定在我的XML的地方,當我與一個TextView的替代佈局的內容,並設置它工作正常的文字。

回答

3

問題是,佈局文件中的studentSearch EditText元素未指定layout_height屬性。一旦你補充說問題應該消失(我也在本地驗證了這一點)。錯誤信息和相應的堆棧跟蹤也將通過ADB logcat output可見:

I/dalvikvm(2083): Ljava/lang/RuntimeException;: Binary XML file line #14: You must supply a layout_height attribute. 
+0

修正了這個問題。並仍然做同樣的事情,這裏的logcat輸出 - > http://pastie.org/2039452 – jondavidjohn 2011-06-08 20:29:22

+0

那裏沒有太多,但它看起來像調試器啓動時有一些麻煩。我建議嘗試一個乾淨的構建並再次啓動,看看它是否有幫助。從任務管理器中殺死adb.exe實例也可能有所幫助。 – 2011-06-08 20:40:01

+1

另一件值得一提的事情是,您可能想嘗試運行應用程序而不進行調試。 Mono For Android中的調試器有時可能會非常緩慢,所以當您不需要它時不用它就可以獲得更好的性能。 – 2011-06-08 20:49:29

0

'掛'是什麼意思?就像,停在調試器中?崩潰?

不應該是setContentView(),而不是設置爲大寫字母S?也許這就是問題所在。

+0

停止在調試器,凍結的Visual Studio,然後撞毀我的dev的設備上。在原始問題中更具體。實際上'SetContentView()'是在C#中大寫的,我正在使用Mono for Android。 – jondavidjohn 2011-06-08 20:08:33

+0

設備上logcat中的任何堆棧跟蹤?我不使用VS,但是當我在Eclipse中調試並拋出異常時,它通常會在異常之前切入調試器。 – Pedantic 2011-06-08 20:10:27

+0

他正在使用MonoDroid,所以.Net和Visual Studio,而不是Java。 – 2011-06-08 20:11:05