c# - Android布局问题..不知道如何调试

标签 c# android visual-studio-2010 android-layout xamarin.android

更新____

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

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

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

enter image description here

这是布局学生列表

<?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/

相关文章:

c# - 如何创建受密码保护的项目 Visual Studio 2010

c# - Open XML SDK 2.0 - 如何更新电子表格中的单元格?

c# - 如何从按钮单击调用 Gridview 单元格单击事件

c# - 在 foreach 中使用 Session 变量

java - 安卓+Appium : Scroll inside ListView to specific position and click on it

java - 如何检查 Android 中可用的互联网?

c++ - 分配一定数量的字节时中断

c# - 在代码中处理语音命令以执行命令的智能方式

android - 如何从 inputmethodservice 调用 Activity 并获得响应

c# - 从 Windows Phone 7 访问 WiFi 信息