簡體   English   中英

提供錯誤-setContentView(R.layout.splash);

[英]Giving error at - setContentView(R.layout.splash);

我的splash.java代碼是:

package com.example.copyandroid1;

import android.app.Activity;
import android.os.Bundle;

public class Splash extends  Activity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout);

    }


}

R.layoutsetContentView()一個類,但int setContentView() (如果使用其他重載,則為View )。

改成

setContentView(R.layout.splash);

其中splash是指res/layout/splash.xml


顯示的錯誤是:“飛濺無法解決或不是字段。”

然后,您的布局資源文件夾中沒有splash.xml ,或者在構建資源時出現了一些問題,並且未更新R.java

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM