Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 添加ImageView时应用程序崩溃_Java_Android_Imageview - Fatal编程技术网

Java 添加ImageView时应用程序崩溃

Java 添加ImageView时应用程序崩溃,java,android,imageview,Java,Android,Imageview,这是我的xml。imageview1工作正常,添加第二个imageview时出现问题。我做了一些研究,发现这个问题与@id+/有关,但我并没有真正理解。有人能告诉我出了什么事吗 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"

这是我的xml。imageview1工作正常,添加第二个imageview时出现问题。我做了一些研究,发现这个问题与@id+/有关,但我并没有真正理解。有人能告诉我出了什么事吗

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<Button
    android:id="@+id/button3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:enabled="false"
    android:text="@string/next"
    android:textSize="30sp" />

<Button
    android:id="@+id/button2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_toLeftOf="@+id/button3"
    android:enabled="false"
    android:text="@string/check"
    android:textSize="30sp" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/button3"
    android:text="@string/mensaje"
    android:textSize="35sp" />

<TextView
    android:id="@+id/textView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/textView2"
    android:layout_marginTop="135dp"
    android:gravity="center"
    android:text="@string/pais"
    android:textSize="35sp" />

<EditText
    android:id="@+id/editText1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textView1"
    android:layout_centerHorizontal="true"
    android:ems="10"
    android:inputType="text" >

    <requestFocus />
</EditText>

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="200dp"
    android:layout_height="100dp"
    android:layout_below="@+id/textView2"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="20dp"
    android:src="@drawable/canada" />

<TextView
    android:id="@+id/textView3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/button2"
    android:layout_alignBottom="@+id/button2"
    android:layout_alignParentLeft="true"
    android:text="TextView"
    android:textSize="25sp" />

<ImageView
    android:id="@+id/imageView2"
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:layout_alignTop="@+id/editText1"
    android:layout_toRightOf="@+id/editText1"
    android:src="@drawable/paloma" />

</RelativeLayout>

您的
RelativeLayout
没有结束标记。把这个放在下面:

</RelativeLayout>


另外,您是否确保您在
ImageView
上放置的可绘图文件存在?

您的
RelativeLayout
没有结束标记。把这个放在下面:

</RelativeLayout>


另外,您是否确保您在
ImageView
上放置的可绘图文件存在?

您的
RelativeLayout
没有结束标记。把这个放在下面:

</RelativeLayout>


另外,您是否确保您在
ImageView
上放置的可绘图文件存在?

您的
RelativeLayout
没有结束标记。把这个放在下面:

</RelativeLayout>


另外,您是否确保您在
ImageView
上放置的可绘图文件存在?

将RelativeLayout替换为

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >


只能有一个xmlns属性代码中有两个

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >


只能有一个xmlns属性代码中有两个

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >


只能有一个xmlns属性代码中有两个

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >



只能有一个xmlns属性代码中有两个属性

可以发布错误日志吗?使用
@+id
的方式是错误的。只有在第一次使用新标识符时,才应将
@+id
与+一起使用。之后的所有其他时间都应使用
@id
@+id
创建一个新变量,您只想执行一次。您能在此基础上展开吗?例如,在button2中,您应该使用上面已经声明的
+@id/button3
来使用android:layout\u-toLeftOf=“@id/button3”。这就是我的想法。仍然无法工作,但您可以发布错误日志吗?您使用
@+id
的方式是错误的。只有在第一次使用新标识符时,才应将
@+id
与+一起使用。之后的所有其他时间都应使用
@id
@+id
创建一个新变量,您只想执行一次。您能在此基础上展开吗?例如,在button2中,您应该使用上面已经声明的
+@id/button3
来使用android:layout\u-toLeftOf=“@id/button3”。这就是我的想法。仍然无法工作,但您可以发布错误日志吗?您使用
@+id
的方式是错误的。只有在第一次使用新标识符时,才应将
@+id
与+一起使用。之后的所有其他时间都应使用
@id
@+id
创建一个新变量,您只想执行一次。您能在此基础上展开吗?例如,在button2中,您应该使用上面已经声明的
+@id/button3
来使用android:layout\u-toLeftOf=“@id/button3”。这就是我的想法。仍然无法工作,但您可以发布错误日志吗?您使用
@+id
的方式是错误的。只有在第一次使用新标识符时,才应将
@+id
与+一起使用。之后的所有其他时间都应使用
@id
@+id
创建一个新变量,您只想执行一次。您能在此基础上展开吗?例如,在button2中,您应该使用上面已经声明的
+@id/button3
来使用android:layout\u-toLeftOf=“@id/button3”。这就是我的想法。还是不行,我有,我只是没把它放在问题里。我现在就修好。另外,de imageview确实存在SWOPS,我确实有它,我只是没有把它放在问题中。我现在就修好。另外,de imageview确实存在SWOPS,我确实有它,我只是没有把它放在问题中。我现在就修好。另外,de imageview确实存在SWOPS,我确实有它,我只是没有把它放在问题中。我现在就修好。此外,de-imageview不存在