简体   繁体   中英

Eclipse Android development

Eclipse's Android/layout/main.xml modifications could not show up while running MainActivity.java . Here is code of 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);
    }
}

Add this line

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

after

super.onCreate(savedInstanceState);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM