2011-08-05 3 views
0

TabHost에는 세 개의 탭이 있습니다. 이 탭 중 하나에는 ListActivity가 있습니다. 세 개의 탭 모두 스크롤 할 수 있기를 바랍니다. 처음에는 ScrollView 안에 FrameLayout (tabcontent)을 넣었지만 ListActivity를 ScrollView에 넣을 수는 없으므로 ListActivity를 사용하여 세 번째 탭을 제외한 각 탭에 대해 ScrollView를 추가했습니다. 이제 스크롤은 두 번째 탭에서만 작동합니다. 처음 스크롤하려고 할 때 스크롤바가 움직이지만 내용은 그렇지 않습니다. 첫 번째 탭에있을 때에도 두 번째 탭에 포커스가있는 ScrollView 만있는 것처럼 보입니다.스크롤보기 내에서 탭이있는 TabHost - 한 탭에서만 스크롤됩니다.

내 레이아웃 :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@color/black"> 

    <TabHost 
     android:id="@android:id/tabhost" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:padding="5dp"> 
      <TabWidget 
       android:id="@android:id/tabs" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" /> 
      <FrameLayout 
       android:id="@android:id/tabcontent" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent"> 
       <!-- TAB1 --> 
       <ScrollView 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"> 
        <LinearLayout 
         android:id="@+id/tab1Layout" 
         android:orientation="vertical" 
         android:layout_width="fill_parent" 
         android:layout_height="fill_parent" 
         android:padding="5dp"> 
         <TextView 
          anddroid:id="@+id/textview11" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" /> 
         <TextView 
          anddroid:id="@+id/textview12" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" /> 
         <TextView 
          anddroid:id="@+id/textview13" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" /> 
         <TextView 
          anddroid:id="@+id/textview14" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" /> 
          <!-- FEW MORE TEXTVIEWS --> 
        </LinearLayout> 
       </ScrollView> 
       <!-- TAB 2 --> 
       <ScrollView 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"> 
        <LinearLayout 
         android:id="@+id/tab2Layout" 
         android:orientation="vertical" 
         android:layout_width="fill_parent" 
         android:layout_height="fill_parent" 
         android:padding="5dp"> 
         <TextView 
          anddroid:id="@+id/textview21" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" /> 
         <TextView 
          anddroid:id="@+id/textview22" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" /> 
         <TextView 
          anddroid:id="@+id/textview23" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" /> 
         <TextView 
          anddroid:id="@+id/textview24" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" /> 
          <!-- FEW MORE TEXTVIEWS --> 
        </LinearLayout> 
       </ScrollView> 
       <!-- TAB3 --> 
       <!-- ListActivity here --> 
      </FrameLayout> 
     </LinearLayout> 
    </TabHost> 
</LinearLayout> 

답변

1

그것은 같은 아니라고

별도의있는 ScrollView 또는 TabWidget의 그것 자체 탭 및 콘텐츠를 사용할 수있는 FramLayout 을 포함 탭 에 대한보기를받을 수 없어 이 FramLayout에는 Tab을 클릭하여 열려는 Activity가 포함됩니다.

관련 문제