简体   繁体   中英

Android Emulator and Eclipse

I am fairly new to programming and Eclipse.
I've created a hello world app to get used to Eclipse. My app has a background (that I created using paint), a button, and a few texts (that say hello world), but when I start up the android emulator(which is the Nexus S) it starts my app, but instead of seeing the background and hello world text and button, I just see a blank white screen with only a title on the top which I made that says My First App.
Could someone tell me what the problem is and how to fix it?

I'm pretty sure you forgot to either save your xml layout or your didn't assign it to the activity.

after the onCreate add this

setContentView(R.layout.activity_main*your xml layout name*);

it should look like this:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

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