2010-07-21 9 views
1

모두 내림차순 내 응용 프로그램에 TabBar를 추가해야하지만 응용 프로그램이나 활동에 탭 표시 줄을 추가하는 방법을 모르겠습니다. 그 일을 도와 줄 수 있어요? 안드로이드에서 TabBar를 추가하는 방법

당신은 TabHost을 사용할 필요가 당신에게 크람 Kadam

답변

1

감사드립니다. 명확한 예제 here을 찾을 수 있습니다. 설명을 위해 tuto를 읽으십시오. 아래에는 코드 만 있습니다. 한마디로 는 : 당신의 XML을 tabs.xml에서 :
http://schemas.android.com/apk/res
당신은 탭을 표시하기 위해 각 탭에 대한 몇 가지 레이아웃 및 활동에 xml 파일이 필요합니다/로이드 " 로이드 : 방향 ="수직 " 로이드 : layout_width ="fill_parent " 로이드 : layout_height ="fill_parent "활동의 onCreate 방법에 >

<TabHost 
id=”@+id/tabs” 
android:layout_width=”fill_parent” 
android:layout_height=”fill_parent” 
> 

<TabWidget 
id=”@android:id/tabs” 
android:layout_width=”wrap_content” 
android:layout_height=”wrap_content” 
/> 
<FrameLayout 
id=”@android:id/tabcontent” 
android:layout_width=”fill_parent” 
android:layout_height=”200px” 
android:paddingTop=”30px” 
> 
<LinearLayout 
id=”@+id/content1″ 
android:orientation=”vertical” 
android:layout_width=”fill_parent” 
android:layout_height=”fill_parent” 
android:background=”#ff99ccff” 
> 
<TextView 
android:layout_width=”fill_parent” 
android:layout_height=”wrap_content” 
android:text=”tab item uno :) ” 
/> 
</LinearLayout> 
<LinearLayout 
id=”@+id/content2″ 
android:orientation=”vertical” 
android:layout_width=”fill_parent” 
android:layout_height=”fill_parent” 
android:background=”#ffffcc99″ 
> 
<TextView 
android:layout_width=”fill_parent” 
android:layout_height=”wrap_content” 
android:text=”tab item dos :/” 
/> 
<Button 
android:layout_width=”fill_parent” 
android:layout_height=”wrap_content” 
android:text=”tabhost needs” 
/> 
<Button 
android:layout_width=”fill_parent” 
android:layout_height=”wrap_content” 
android:text=”to be upgraded ;) ” 
/> 
</LinearLayout> 
</FrameLayout> 
</TabHost> 
</LinearLayout> 

:

,

감사합니다. Jeff for the tuto

+0

감사합니다. Sephy 고맙습니다. 코드에 구현해 드리겠습니다. – Vikram

+0

Sephy는 탭 막대를 화면의 아래쪽에 맞출 수 있습니다. – Vikram

+0

글쎄, 잘 모르겠다 ... 나는 이것을 기본 디스플레이와 함께 사용하는 데 익숙하다. 난 당신이 TabHost/TabWidget을 무시하고 bevahiour을 변경해야한다고 생각합니다. 꽤 오래 걸릴 수도 있습니다 ... – Sephy

관련 문제