2

更新____

Logcat 输出http://pastie.org/2039452

我的应用程序在调试器中停止,然后在这条线上崩溃,但这很奇怪,因为它没有错误信息,只有一个像这样的绿色箭头......

任何有关此箭头一般含义的见解将不胜感激...

在此处输入图像描述

这是 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 替换布局内容并设置它工作正常的文本时。

4

2 回答 2

3

问题是布局文件中的 studentSearch EditText 元素没有指定layout_height属性。一旦你在问题中添加它应该会消失(我也在本地验证了这一点)。通过ADB logcat 输出也可以看到错误消息和随附的堆栈跟踪:

I/dalvikvm( 2083): Ljava/lang/RuntimeException;: Binary XML file line #14: You must supply a layout_height attribute.
于 2011-06-08T20:16:43.473 回答
0

“挂”是什么意思?就像,在调试器中停止?崩溃?

不应该是setContentView(), 不是 Set 用大写的 S 吗?也许这就是问题所在。

于 2011-06-08T20:06:12.353 回答