2011-11-22 2 views
2

Tabhost가 포함 된 레이아웃이 있습니다. 탭은 화면 하단에 있습니다. 첫 번째 탭은 ActivityGroup을 시작합니다. 해당 ActivityGroup의 첫 번째 활동에는 scrollview가 있습니다. 내용이 스크롤보기에 표시되고 맨 아래로 스크롤하면 스크롤보기의 맨 아래가 탭 뒤에 숨겨집니다. 어떤 아이디어가 이것을 고치는 방법?Android 탭 콘텐츠에 탭 뒤에서 콘텐츠를 숨기는 scrollview가 포함되어 있습니다.

Window window = getLocalActivityManager().startActivity(pActivityClass.getName(), intent); 
setContentView(window.getDecorView()); 

가 장식 전체 화면을 볼 수 있습니다 : 나는 activitygroup를 시작하면

,이 코드를 사용할 수 있습니까? 나는 단지 그 견해가 태블릿이되기를 바랄뿐입니다. 대신 전체 부모를 채우는 콘텐츠보기 탭 위젯 위에 맞도록

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/myScrollView" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"> 

<RelativeLayout android:id="@+id/myLayout" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 

    <TextView android:id="@+id/title" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:textSize="16sp"/> 

     ... a bunch of other components ... 

</RelativeLayout> 
</ScrollView> 

답변

4

이 레이아웃 수정 : 여기

<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <FrameLayout 
     android:id="@android:id/tabcontent" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" 
     android:layout_alignParentTop="true"/> 
    <TabWidget 
     android:id="@android:id/tabs" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true"/> 
</RelativeLayout> 
</TabHost> 

내가 tabcontent에서 원하는이다 : 다음은 주요 레이아웃입니다 컨테이너는 RelativeLayout의 전체 크기로 레이아웃 한 다음 위에 TabWidget을 둡니다. 이 같은 더 뭔가 :

<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <FrameLayout 
    android:id="@android:id/tabcontent" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_above="@android:id/tabs"/> 
    <TabWidget 
    android:id="@android:id/tabs" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true"/> 
</RelativeLayout> 
</TabHost> 

나는 또한 RelativeLayout의 내부에 아무것도하지 않는 android:orientation 같은 불필요한 항목 중 일부를 제거했습니다.

HTH

0

나는이 작업을 수행 할 수있는 "올바른"방법이있을 수 있습니다 알고 있지만 난 그냥 탭에로드 된 XML 파일의 맨 아래에

<LinearLayout android:layout_width="fill_parent" 
     android:layout_height="50dp"></LinearLayout> 

을 추가했다.

또한 user1060374가 맞습니다. 내용을 스크롤해야하는 경우 FrameLayout이 Tabwidget 위에 있어야하거나 scrollview가 탭바 위에 숨겨져 있어야합니다. 하지만이 작업만으로는 질문에 답할 수 없으므로 패딩을 추가했습니다.

1

최적의 결과.


여기
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@android:id/tabhost" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" > 

     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:orientation="vertical" > 

      <HorizontalScrollView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:fillViewport="true" 
       android:scrollbars="none" > 

      <TabWidget 
       **android:minWidth="480dp"** 
       android:id="@android:id/tabs" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 

      </TabWidget> 

      </HorizontalScrollView> 

      <FrameLayout 
       android:id="@android:id/tabcontent" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent"/> 
     </LinearLayout> 
    </TabHost> 
1
<FrameLayout 
android:id="@android:id/tabcontent" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:layout_above="@android:id/tabs"/> 

키 행은의 minWidth = 값을 증가 ...

android:layout_above="@android:id/tabs" 
:

로이드