3 개의 탭이있는 활동을 구현하려고합니다. 이 목적으로 FragmentTabHost를 사용하기로 결정했습니다. 나는 다음과 같은 레이아웃 파일 일부 코드 예제를 발견했습니다FragmentTabHost에서 TabWidget을 명시 적으로 정의해야합니까?
<?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">
<android.support.v4.app.FragmentTabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"/>
</android.support.v4.app.FragmentTabHost>
<FrameLayout
android:id="@+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
를하지만 앞의 코드 샘플 TabWidget없이 동일한 방식으로 작동하는지 이해했을 때 나는 깜짝 놀랐다 : 의도 한대로 난 그냥 내 탭이 표시
<?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">
<android.support.v4.app.FragmentTabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v4.app.FragmentTabHost>
<FrameLayout
android:id="@+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
을 . FragmentTabHost의 소스 코드에 따르면, 뷰의 계층 구조에서 찾을 수없는 경우 TabWidget을 단독으로 만듭니다. 그래서 내 레이아웃 파일에 명시 적으로 TabWidget을 선언해야하는지 궁금합니다.
신속하고 완전한 응답을 보내 주셔서 감사합니다. 네가 옳아. TabWidget 및 FragmentTabHost 설명서에는 몇 가지 세부 사항이 없습니다. –