gpt4 book ai didi

c# - Android布局问题..不确定如何调试

转载 作者:搜寻专家 更新时间:2023-11-01 09:13:41 28 4
gpt4 key购买 nike

更新____

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

最佳答案

问题是布局文件中的 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com