package com.example.sns;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
public class mainTab extends TabActivity {
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.tabactivity);
setupTabs();
}
void setupTabs(){
Resources res = getResources();
TabHost tabs = getTabHost();
TabHost.TabSpec spec = null;
Intent intent = null;
//tab01을 추가
spec = tabs.newTabSpec("tab01");
intent = new Intent(this, listViewBoard.class);
intent.putExtra("mode", "new");
intent.putExtra("initialize", true);
intent.putExtra("request", true);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
spec.setIndicator("게시판", res.getDrawable(R.drawable.f3));
spec.setContent(intent);
tabs.addTab(spec);
//tab02을 추가
spec = tabs.newTabSpec("tab02");
intent = new Intent(this, SubPage02Activity.class);
intent.putExtra("mode", "new");
intent.putExtra("initialize", true);
intent.putExtra("request", true);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
spec.setContent(intent);
spec.setIndicator("채팅");
tabs.addTab(spec);
//tab03을 추가
spec = tabs.newTabSpec("tab03");
intent = new Intent(this, SubPage03Activity.class);
intent.putExtra("mode", "new");
intent.putExtra("initialize", true);
intent.putExtra("request", true);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
spec.setContent(intent);
spec.setIndicator("주변");
tabs.addTab(spec);
// set current tab
tabs.setCurrentTab(0);
}
}
setIndicator를 해주면서 res.getDrawable(R.drawable.f3));을 해줬는데 탭에 '게시판'만 뜨네요...ㅠ