Android 为什么安卓:上面的布局“=”@id/mh01“;当我使用RelativeLayout时是错误的
在我的布局中为什么 android:layout_over=“@id/mh01”在我使用RelativeLayout时是错误的 我不知道为什么这是错误的 更新: 我已经处理了标题描述的问题。但我遇到了一个新问题 此XML代码有一些错误:Android 为什么安卓:上面的布局“=”@id/mh01“;当我使用RelativeLayout时是错误的,android,android-layout,Android,Android Layout,在我的布局中为什么 android:layout_over=“@id/mh01”在我使用RelativeLayout时是错误的 我不知道为什么这是错误的 更新: 我已经处理了标题描述的问题。但我遇到了一个新问题 此XML代码有一些错误: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/andr
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/relativeLayout1">
<ImageView
android:id="@+id/mh011"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/mh01"
android:layout_centerInParent="true"
/>
<ImageView
android:id="@+id/mh022"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/mh02"
android:layout_above="@+id/mh011"
android:layout_centerHorizontal="true"
/>
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/mh033"
android:background="@drawable/mh_03"
android:layout_toLeftOf="@+id/mh011"
android:layout_centerVertical="true"
/>
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/mh044"
android:background="@drawable/mh04"
android:layout_toRightOf="@+id/mh011"
android:layout_centerVertical="true"
/>
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/mh055"
android:background="@drawable/mh05"
android:layout_below="@+id/mh011"
android:layout_centerHorizontal="true"/>
>
</RelativeLayout>
>
更新
试用集:
在所有图像视图中
编辑后的代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/relativeLayout1">
<ImageView
android:id="@+id/mh011"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/mh01"
android:layout_centerInParent="true"
android:contentDescription="@null"
/>
<ImageView
android:id="@+id/mh022"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/mh02"
android:layout_above="@+id/mh011"
android:layout_centerHorizontal="true"
android:contentDescription="@null"
/>
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/mh033"
android:background="@drawable/mh_03"
android:layout_toLeftOf="@+id/mh011"
android:layout_centerVertical="true"
android:contentDescription="@null"
/>
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/mh044"
android:background="@drawable/mh04"
android:layout_toRightOf="@+id/mh011"
android:layout_centerVertical="true"
android:contentDescription="@null"
/>
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/mh055"
android:background="@drawable/mh05"
android:layout_below="@+id/mh011"
android:layout_centerHorizontal="true"
android:contentDescription="@null"
/>
>
</RelativeLayout>
>
左上角有一个引号,删除第一行的双引号,并在引用id@+id时添加加号/MH01欢迎使用SO。强烈不鼓励您将代码作为截图发布。我不确定您是否在引用to@Yazhini不需要。+
符号仅用于预期参考,我个人不建议这样做。我尝试过,但没有效果。我更改了imageView的id,认为它有效,但我遇到了一个新问题。@sitinglin更新您的问题并设置您的XML代码,我将检查这是我第一次使用它。我试试。没关系,在问题中按文本编辑,设置XML代码并保存
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/relativeLayout1">
<ImageView
android:id="@+id/mh011"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/mh01"
android:layout_centerInParent="true"
android:contentDescription="@null"
/>
<ImageView
android:id="@+id/mh022"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/mh02"
android:layout_above="@+id/mh011"
android:layout_centerHorizontal="true"
android:contentDescription="@null"
/>
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/mh033"
android:background="@drawable/mh_03"
android:layout_toLeftOf="@+id/mh011"
android:layout_centerVertical="true"
android:contentDescription="@null"
/>
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/mh044"
android:background="@drawable/mh04"
android:layout_toRightOf="@+id/mh011"
android:layout_centerVertical="true"
android:contentDescription="@null"
/>
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/mh055"
android:background="@drawable/mh05"
android:layout_below="@+id/mh011"
android:layout_centerHorizontal="true"
android:contentDescription="@null"
/>
>
</RelativeLayout>