1
탭 호스트를 사용하여 탭을 표시하지만 레이아웃에 드래그 앤 드롭하여 실행해도 탭이 보이지 않고 흰색 화면이 나타납니다. 첫 번째 탭보기의 선형 레이아웃탭 호스트가 탭을 표시하지 않습니다.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/tab1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</LinearLayout>
<LinearLayout
android:id="@+id/tab2"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</LinearLayout>
<LinearLayout
android:id="@+id/tab3"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
위에서 에뮬레이터 또는 전화 (Huawei Ascend P1)를 실행하면 탭이 표시되지 않습니다.
일부 탭을 추가 했습니까? – Luksprog
탭이 xml 레이아웃에 추가되었습니다. 프로그래밍을 통해 탭을 추가하셨습니까? – kaibuki
예, 코드에 탭이 추가되었습니다. – Luksprog