Eclipse Android开发

时间:2014-08-22 19:02:11

标签: android eclipse android-layout

运行Android/layout/main.xml时,Eclipse的MainActivity.java修改无法显示。以下是MainActivity.java的代码:

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;

public class MainActivity extends AndroidApplication {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
        cfg.useGL20 = false;

        initialize(new ZBGame(), cfg);
    }
}

1 个答案:

答案 0 :(得分:1)

添加此行

setContentView(R.layout.main); //this will set view to your main.xml file.

super.onCreate(savedInstanceState);