这个错误我搜了下,都说是布局问题,我就在main.xml作了如下布局
JAVA代码中是没有的,请问问题在哪
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />
    <TextView
        android:id="@+id/textView1"
        android:layout_width="304dp"
        android:layout_height="90dp"
        android:text="TextView" />    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />    <ImageSwitcher
        android:id="@+id/imageSwitcher1"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.41" >
    </ImageSwitcher></LinearLayout>

解决方案 »

  1.   

    把一个View实例加入到两个布局会抛出这个异常。你查一下是不是把同一个控件,加入到了两个不同的布局中?
      

  2.   

    main.xml中不是就一个</LinearLayout>吗
    java代码中没布局
    刚接触android
    还有哪里可能会有布局?
      

  3.   

    我4了下,这种布局
    在java代码中TextView tv = (TextView)findViewById(R.id.textView1);
    tv竟然是null
    求指教我需要android常用控件EditText,TextView,2个Button,ImageView
    谁能给个示例