小编use*_*356的帖子

Android“无法解析符号'@id/myLabel”

我收到一个错误,说“ Cannot resolve symbol '@id/myLabel'”。以下元素也有同样的错误:

"Cannot resolve symbol '@id/numberStudents'"
"Cannot resolve symbol '@id/accept'"
Run Code Online (Sandbox Code Playgroud)

请帮我解决这个问题。我的 xml 示例粘贴在下面。

谢谢,阿比拉什·卡达拉。

<?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/myLabel"
        android:text="Name of student:"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
    />
    <EditText
        android:id="@+id/numberStudents"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/myLabel"
    />
    <Button
        android:id="@+id/accept"
        android:text="Accept"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/numberStudents"
        android:layout_alignParentRight="true"
        android:layout_marginLeft="10px"
    />
    <Button
        android:id="@+id/cancel"
        android:text="Cancel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@id/accept"
        android:layout_alignTop="@id/accept"
    />

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

java xml android android-layout

1
推荐指数
3
解决办法
4938
查看次数

标签 统计

android ×1

android-layout ×1

java ×1

xml ×1