[英]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.layout
是setContentView()
一個類,但int
setContentView()
(如果使用其他重載,則為View
)。
改成
setContentView(R.layout.splash);
其中splash
是指res/layout/splash.xml
。
顯示的錯誤是:“飛濺無法解決或不是字段。”
然后,您的布局資源文件夾中沒有splash.xml
,或者在構建資源時出現了一些問題,並且未更新R.java
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.