"findViewById(R.id.video)" 错误

Error on "findViewById(R.id.video)"

请帮助我,因为我陷入了一个白痴错误:( ..

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <VideoView
        android:id="@+id/video"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@android:color/background_dark"/>
    <Button 
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

</RelativeLayout>

这是 xml 我认为是正确的。

public class MainActivity extends Activity {

    VideoView videoview;
    Button button;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //videoview=(VideoView)findViewById(R.id.video);
        //button=(Button)findViewById(R.id.button);


    }

那个是 java 文件..当我通过他们的 ID 获取 videoview 和按钮时,我收到一个错误。错误是 "video cannot be resolved or is not a field"

如果你知道解决办法请告诉我 谢谢

构建并清理项目将解决您的问题