这个 xml 布局文件有什么问题吗?为什么 setContentView 在加载此文件后失败,并且应用在此之后关闭



这是XML文件。奇怪的是,我的程序在执行 setContentView 后立即退出。日志猫只显示这个

线程

id=1 线程退出并出现未捕获的异常 (组 = 0x417d)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">

  <TextView android:id="@+id/SpeechResult"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:background="@drawable/rounded_edge"
    android:padding="6dip"
    android:hint="Waht is on your mind?"/>
  <ToggleButton
    android:id="@+id/ToggleRecognition"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:textOff="Start"
    android:textOn="Stop"
    android:onClick="onToggleRecognition"/>
</LinearLayout>

我发现了调整,这真的很令人困惑,我认为 eclipse 至少应该有一些调试信息,因为这真的很吸引人。该问题与文本视图中缺少layout_width属性有关。不知道为什么这会导致崩溃,但至少添加它使Maggice

最新更新