티스토리 툴바

블로그 이미지
그때의 이야기, 우리들의 소중한 꿈이 되었다. 밍공™

카테고리

분류 전체보기 (12)
소소한 일상 (0)
생각속으로.. (0)
읽은 책 (0)
세상 이야기 (0)
지름신 강림 (0)
페이퍼크래프트 (0)
정보 (0)
Android (11)
Total3,242
Today0
Yesterday2

'TabView'에 해당되는 글 1건

  1. 2010/07/06 custom TabView

custom TabView

Android / 2010/07/06 18:15

.xml

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content">

 <ImageView android:id="@+id/IVIcon"
  android:src="@drawable/icon"
  android:layout_width="wrap_content"
  android:layout_gravity="center"/>
 
 <TextView android:id="@+id/TVCaption"
  android:text="Caption"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_gravity="center"/>
</LinearLayout>

 

 

.java

 

TabHost tabHost = (TabHost) findViewById(R.id.tabHost);

// TabHost를 findViewById로 생성한 후 Tab추가 전에 꼭 실행해 주어야 함.
tabHost.setup();

// 새로운 Tab을 생성하기 위한 Tab객체 생성
TabHost.TabSpec spec;

// Custom View for TabWidget
LayoutInFlater layout = getLayoutInglater();

// 첫번째 Tab 설정 및 등록
spec = tabHost.newTabSpec("Tab 00");
// 새 Tab생성
View vTab1 = layout.inflate(R.layout.mytabwidget, null);
TextView tvCaption = (TextView) vTab1.findViewById(R.id.TVCaption);
tvCaption.setText("Custom Tab 1");
spec.setIndicator(vTab1);

// Tab 제목
spec.setContent(R.id.layout);
// Tab 내용
tabHost.addTab(spec);

//생성 된 Tab등록
// 두번째 Tab 설정 및 등록

 

저작자 표시
Posted by 훈남, 밍공™

댓글을 달아 주세요

최근에 달린 댓글

최근에 받은 트랙백

글 보관함