Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/357.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 未指定资源类型(在';id';处,值为&';@&&+;id\st&';)_Java_Android_R.java File - Fatal编程技术网

Java 未指定资源类型(在';id';处,值为&';@&&+;id\st&';)

Java 未指定资源类型(在';id';处,值为&';@&&+;id\st&';),java,android,r.java-file,Java,Android,R.java File,我是android编程新手,我现在尝试制作一些按钮,我使用以下代码配置了这些按钮: 主要活动课程: public class MainActivity extends Activity { /** Called when the activity is first created. */ Button st,nd,center; @Override public void onCreate(Bundle savedInstanceState) {

我是android编程新手,我现在尝试制作一些按钮,我使用以下代码配置了这些按钮:

主要活动课程:

public class MainActivity extends Activity
{
    /** Called when the activity is first created. */

    Button st,nd,center;
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        st = (Button)findViewById(R.id.st);
        st = (Button)findViewById(R.id.center);
        st = (Button)findViewById(R.id.nd);


    }
}
以及XML布局

<?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"
    android:background="@drawable/background"
    >
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Hello from animation!!"
    />
<button android:layout_width="100dp"
android:layout_height="50dp"
android:text="1st half"
android:id="@+id\st"
/>
// and the other two points defined the same way
</LinearLayout>

提示:导入
R类
并可从
MainActivity
类访问,但它无法读取
R.id

按钮
替换为
按钮
android:id=“@+id\st”
替换为
android:id=“@+id/st”

按钮替换
按钮
android:id=“@+id\st”
android:id=“@+id/st”
按钮替换
按钮
android:id=“@+id\st”
android:id=“@+id/st”替换

按钮替换
按钮
android:id=“@+id\st”
android:id=“@+id/st”
你用
按钮代替
按钮
。它区分大小写。 在
android:id
中,通过
/
替换
\

这是正确的代码:

<Button android:layout_width="100dp"
    android:layout_height="50dp"
    android:text="1st half"
    android:id="@+id/st"
/>


用这个替换你的按钮代码,它应该可以工作

你用
按钮
代替
按钮
。它区分大小写。 在
android:id
中,通过
/
替换
\

这是正确的代码:

<Button android:layout_width="100dp"
    android:layout_height="50dp"
    android:text="1st half"
    android:id="@+id/st"
/>


用这个替换你的按钮代码,它应该可以工作

你用
按钮
代替
按钮
。它区分大小写。 在
android:id
中,通过
/
替换
\

这是正确的代码:

<Button android:layout_width="100dp"
    android:layout_height="50dp"
    android:text="1st half"
    android:id="@+id/st"
/>


用这个替换你的按钮代码,它应该可以工作

你用
按钮
代替
按钮
。它区分大小写。 在
android:id
中,通过
/
替换
\

这是正确的代码:

<Button android:layout_width="100dp"
    android:layout_height="50dp"
    android:text="1st half"
    android:id="@+id/st"
/>


用这个替换按钮代码,它应该可以工作

代码中有一些语法错误

首先使用
按钮
而不是按钮

在id之后使用/而不是\

<Button android:layout_width="100dp"
android:layout_height="50dp"
android:text="1st half"
android:id="@+id/st"
/>

您的代码中有一些语法错误

首先使用
按钮
而不是按钮

在id之后使用/而不是\

<Button android:layout_width="100dp"
android:layout_height="50dp"
android:text="1st half"
android:id="@+id/st"
/>

您的代码中有一些语法错误

首先使用
按钮
而不是按钮

在id之后使用/而不是\

<Button android:layout_width="100dp"
android:layout_height="50dp"
android:text="1st half"
android:id="@+id/st"
/>

您的代码中有一些语法错误

首先使用
按钮
而不是按钮

在id之后使用/而不是\

<Button android:layout_width="100dp"
android:layout_height="50dp"
android:text="1st half"
android:id="@+id/st"
/>