2012-07-31 3 views
0

나는 이것이 이상하다고 생각하지만 나와 곰을 알고 있습니다.TabHost - 하단 정렬, 사용 중지 및보기가 표시되지 않음

사용자 정의보기가 있는데, TabHost를 확장하고 XML을 부 풀립니다. 여러보기가 포함되어 있으며 하단에 정렬되어 있으며 모든 것이 잘 작동합니다.

문제는 내가 TabHost보기를보고 싶지 않은 다른 활동에 TabHost를 넣을 때입니다. 활동 레이아웃 상단에 TabHost 탭만 있습니다. 기본적으로, 나는 TabHost가 장애가있는 하단 막대로 존재하기를 원합니다. 여기

<?xml version="1.0" encoding="utf-8"?> 
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+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" > 

     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_weight="1" 
      > 

      <CustomView#1 
       android:id="@+id/tab_watch_me" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" /> 

      <CustomView#2 
       android:id="@+id/tab_messages" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" /> 

      <CustomView#3 
       android:id="@+id/tab_search_results" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" /> 

      <CustomView#4 
       android:id="@+id/tab_my_profile" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" /> 

      <CustomView#5 
       android:id="@+id/tab_user_profile" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" /> 
     </FrameLayout> 

     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="0" /> 
    </LinearLayout> 

</TabHost> 

가 활동 XML (I 원하지 않는 하나 : 여기

는 (한 나는 사용자 정의보기 중 하나를 전환으로, 좋은 작품과 하단에 정렬)을 TabHost의 XML입니다 tabhost보기 만 아래로 tabhost 버튼)을 정렬, 표시하기 :

<?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" > 

    <customview.HeaderView 
     android:id="@+id/header_view" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" /> 

**//Notice that I don't want to show any of the customViews the tabhost hold. only the tabhost tabs/buttons** 

    <customview.MyTabHost 
     android:id="@+id/settings_tabhost" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

</LinearLayout> 

을 돕기 위해 더 많은 코드가 필요 알려줘!

감사합니다.

+0

그래서 당신은 거기에 있기를 원하지만 아무런 일도하지 않고 아무런 상호 작용도하지 않겠습니까? – Rick

+0

@Rick 이상하게 들리지만 그렇습니다. RelativeLayout을 사용하여 관리했지만 그 솔루션을 사용하지 않는 것이 좋습니다. –

+0

탭을 선택하면 코드를 통해 사용자 지정 콘텐츠보기를 추가 할 수 있습니까? – CSmith

답변

0

내 RelativeLayout 솔루션을 사용하면 누구에게나 도움이됩니다. 누구든지 제공해야한다면 여전히 더 나은 솔루션을 찾고 있습니다.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <customview.HeaderView 
     android:id="@+id/header_view" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" /> 

<Any other view 
android:layout_below="@+id/header_view" 
/> 

    <customview.MyTabHost 
     android:id="@+id/settings_tabhost" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentBottom="true" /> 

</RelativeLayout>