更新____
Logcat 输出 http://pastie.org/2039452
我的应用程序在调试器中停止,然后在这一行崩溃,但这很奇怪,因为它没有错误信息,只有一个绿色箭头,如下所示...
任何有关此箭头一般含义的见解将不胜感激......
这是布局学生列表
<?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 替换布局内容并设置文本时,它工作正常。
最佳答案
问题是布局文件中的 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.
关于c# - Android布局问题..不知道如何调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6284299/