2012-06-12 4 views
0

나는 4 개의 탭 위젯을 가지고 있으며 그 중 처음 세 가지를 클릭하면 각각의 활동을 시작해야하며 네 번째 탭을 클릭하면 레이아웃이 이전 활동과 배경에 있어야하며 탭 바로 아래에 빠른 작업 유형 대화 상자가 나타납니다. 이것이 가능한가. 누군가 제안 해주십시오.활동을 시작하지 않는 탭 위젯을 포함하는 TabHost

답변

0

희망이 도움이 될 것입니다! 수업 TabhostActivity에서 (TabActivity를 확장), 당신은 추가했습니다 : 다른 사람에 대한

Resources res = getResources(); 
    TabHost tabHost = getTabHost(); 
    TabHost.TabSpec spec; 
    Intent intent; 

    // Create an Intent to launch an Activity for the tab (to be reused) 
    intent = new Intent().setClass(this, your_first_tab.class); 

    // Initialize a TabSpec for the first tab 
    spec = tabHost.newTabSpec("").setIndicator("",res.getDrawable(R.drawable.ic_tab_name_of_the_first_tab)).setContent(intent); 
    tabHost.addTab(spec); 

// Initialize a TabSpec for the second tab 
    intent = new Intent().setClass(this, your_second_tab.class); 
    spec = tabHost.newTabSpec("").setIndicator("",res.getDrawable(R.drawable.ic_tab_name_of_the_second_tab)).setContent(intent); 
    tabHost.addTab(spec); 

같은 일을.

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
<!-- When selected, use grey --> 
<item android:drawable="@drawable/first_icon_grey" 
     android:state_selected="true" /> 
<!-- When not selected, use white--> 
<item android:drawable="@drawable/first_icon_white" /> 

:


ic_tab_name_of_the_first_tab는 같은 XML 파일입니다

관련 문제