안녕하세요 안펍님들..

 

탭을 구성하고 싶은데..

 

인터넷의 정보로는 자꾸 오류가 나더군요...ㅜㅜ

 

너무너무 답답해서 질문을 올리게 되었습니다..

 

탭 클래스

 

 
package com.efonia;
import android.app.TabActivity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.widget.TabHost;
import android.widget.Toast;
public class EfoniaTab extends TabActivity {
 private static final int MENU_ITEM=0;
 
 protected void onCreate(Bundle savedInstanceState) {
        Log.d(null, "----------------tab0");
  super.onCreate(savedInstanceState);
     requestWindowFeature(Window.FEATURE_NO_TITLE);      // 타이틀바 제거    
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // 화면 가로돌림 방지
        
        Log.d(null, "----------------tab1");
        setContentView(R.layout.tap);
        Log.d(null, "----------------tab2");        
        final TabHost tabHost = getTabHost();    
        
        Log.d(null, "----------------tab3");        
        getLayoutInflater().inflate(R.layout.main, tabHost.getTabContentView());
        
        Log.d(null, "----------------tab4");        
        tabHost.addTab(tabHost.newTabSpec("tab1").setIndicator("tab1").setContent(R.layout.dialer));
        tabHost.addTab(tabHost.newTabSpec("tab2").setIndicator("tab1").setContent(R.layout.dialer));
        tabHost.addTab(tabHost.newTabSpec("tab3").setIndicator("tab1").setContent(R.layout.dialer));
    }
 

 

 <?xml version="1.0" encoding="UTF-8"?>
<TabHost 
xmlns:android="http://schemas.android.com/apk/res/android"     
android:id="@android:id/tabhost"    
android:layout_width="match_parent"     
android:layout_height="match_parent">    
 <LinearLayout 
 android:orientation="vertical"        
 android:layout_width="match_parent"         
 android:layout_height="match_parent">        
 
 <TabWidget android:id="@android:id/tabs"            
 android:orientation="horizontal"             
 android:layout_width="match_parent"            
 android:layout_height="wrap_content"             
 android:layout_weight="0" />        
 
 <FrameLayout android:id="@android:id/tabcontent"            
 android:layout_width="match_parent"             
 android:layout_height="0dip"            
 android:layout_weight="1"/>    
 
 </LinearLayout>
 
</TabHost>

오류자체는 없는데 실행하면

잘되지가 않네요..(죄송합니다^%^ 수정했습니다~)

 

코드에 어떤 문제점이있는지 한번 봐주세요^^;;\\

profile