简体   繁体   中英

Android adding a layout to a tab

I've completed the tutorial on http://developer.android.com/resources/tutorials/views/hello-tabwidget.html so that now in my code, every activity has its own entry in the manifest and its own class such as....

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

public class PetCareActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        TextView textview = new TextView(this);
        textview.setText("This is the Pet Care tab");
        setContentView(textview);
    }
}

The problem is at this point, I can only do things like creating textView. How would I add extra content within the tab, similar to https://market.android.com/details?id=com.bskyb.sportnews&hl=en

Thanks,

David

Simple. You pass the layout resource id to setContentView .

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