세 가지 활동에 대한 탭을 만드는이 기본 탭 막대 레이아웃이 있습니다. 주요 활동 내에서 활동을 교환하고 싶다면 어떻게해야합니까?탭 막대 레이아웃 내의 활동 간 전환
기본 연락처 탭이있는 주소록 앱과 연락처를 클릭 할 때 자세한 활동이 필요합니다. 당신은 어떻게 TabHost로 활동을 대체 할 새로운 활동을 시작하는 요청하는 경우
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = getTabHost();
// Tab for Photos
TabSpec photospec = tabHost.newTabSpec("Photos");
// setting Title and Icon for the Tab
photospec.setIndicator("Photos", getResources().getDrawable(R.drawable.icon_photos_tab));
Intent photosIntent = new Intent(this, PhotosActivity.class);
photospec.setContent(photosIntent);
// Tab for Songs
TabSpec songspec = tabHost.newTabSpec("Songs");
songspec.setIndicator("Songs", getResources().getDrawable(R.drawable.icon_songs_tab));
Intent songsIntent = new Intent(this, SongsActivity.class);
songspec.setContent(songsIntent);
// Tab for Videos
TabSpec videospec = tabHost.newTabSpec("Videos");
videospec.setIndicator("Videos", getResources().getDrawable(R.drawable.icon_videos_tab));
Intent videosIntent = new Intent(this, VideosActivity.class);
videospec.setContent(videosIntent);
// Adding all TabSpec to TabHost
tabHost.addTab(photospec); // Adding photos tab
tabHost.addTab(songspec); // Adding songs tab
tabHost.addTab(videospec); // Adding videos tab
}*
탭 항목을 클릭하면 탭 안의 탭처럼 보이시겠습니까? –