// main.xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
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"
android:padding="5dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@android:id/tabcontent"
android:layout_weight="1"
android:padding="5dp"/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:tabStripEnabled="false">
</TabWidget>
</LinearLayout>
</TabHost>
위와 같은 식으로 탭 1~4까지 탭 호스트로 구성하였고 탭 안에 탭도 따로 레이아웃을 만들어서 자바 파일로 인텐트 시켜서 탭을 추가했습니다.
// MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context = this;
setContentView(R.layout.main);
TabHost mTab = getTabHost();
TabHost.TabSpec spec;
Intent intent;
intent = new Intent(this, Tab1.class);
spec = mTab.newTabSpec("Tab1").setIndicator("배차")
.setContent(intent);
mTab.addTab(spec);
intent = new Intent(this, Tab2.class);
spec = mTab.newTabSpec("Tab2").setIndicator("관제")
.setContent(intent);
mTab.addTab(spec);
intent = new Intent(this, Tab3.class);
spec = mTab.newTabSpec("Tab3").setIndicator("DTG")
.setContent(intent);
mTab.addTab(spec);
intent = new Intent(this, Tab4.class);
spec = mTab.newTabSpec("Tab4").setIndicator("기타")
.setContent(intent);
mTab.addTab(spec);
for (int tab = 0; tab < mTab.getTabWidget().getChildCount(); ++tab) {
mTab.getTabWidget().getChildAt(tab).getLayoutParams().height = 120;
RelativeLayout relLayout = (RelativeLayout)mTab.getTabWidget().getChildAt(tab);
TextView tv = (TextView)relLayout.getChildAt(1);
tv.setTextSize(20);
}
checkVersionUpdate();
alertGpsService();
}
기존에 적용되있던 테마는 위 탭 아래에 그림자가 생겨서 ㅠㅠ
android:theme="@android:style/Theme.NoTitleBar" 테마로 설정해놓았습니다.
아래 화면은 여백을 보이게 하려고 Theme.Light.NoTitleBar 테마로 설정한 화면입니다.
근데 이 테마로 하니까
또 배경화면 색이나 리스트 뷰에 구분선 변경이 안되네요.

탭이 화면에 꽉 차게? 할 수있는 방법 없을까요... 구글링해도 나오지 않아 질문합니다.