2015-02-06 66 views
0

由於每個選項卡中的信息可能無法顯示,具體取決於屏幕大小,因此我添加了滾動視圖。列表視圖顯示數據庫中的信息,但不會在屏幕上傳播。它只需要屏幕的一小部分,我只能在這一小部分中滾動。如果我有兩組信息,我希望看到兩行,但我只看到一行,然後我可以在其中滾動以查看第二組信息。但是,當我刪除滾動視圖我的列表視圖顯示它應該是,但其他標籤遭受,因爲我不能滾動查看其他領域。 下面是我的主要活動:ListView併發症

<TabHost 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/tabHost"> 


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

     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"></TabWidget> 

     <ScrollView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/scrollView" 
      android:fillViewport="true"> 

     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"> 

      <!--Overview Tab Starts--> 


      <LinearLayout 
       android:id="@+id/overviewTab" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:orientation="vertical"> 

       <ListView 
        android:id="@+id/displayListView" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" /> 

      </LinearLayout> 


      <!--Overview Tab ends--> 

      <!--Base Data Tab starts--> 

        <LinearLayout 
         android:id="@+id/baseDataTab" 
         android:layout_width="fill_parent" 
         android:layout_height="fill_parent" 
         android:orientation="vertical" 
         android:padding="15dp"> 

         //the needed views go here// 

        </LinearLayout> 

      <!--Base Data Tab ends--> 

      <!--Task Tab starts--> 

       <LinearLayout 
        android:id="@+id/taskTab" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:orientation="vertical" 
        android:padding="15dp"> 

        //the needed views go here// 

       </LinearLayout> 

      <!--Task Tab ends--> 

      <!--Survey Tab starts--> 

       <LinearLayout 
        android:id="@+id/surveyTab" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:orientation="vertical" 
        android:padding="15dp"> 

        //the needed views go here// 

       </LinearLayout> 


      <!--Survey Tab ends--> 

     </FrameLayout> 

     </ScrollView> 
    </LinearLayout> 
</TabHost> 

回答

0
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/tabHost" 
android:layout_width="match_parent" 
android:layout_height="fill_parent" > 

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

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

    <ScrollView 
     android:id="@+id/scrollView" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fillViewport="true" > 

     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" > 

      <!-- Overview Tab Starts --> 

      <LinearLayout 
       android:id="@+id/overviewTab" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:orientation="vertical" > 

       <ListView 
        android:id="@+id/displayListView" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" /> 
      </LinearLayout> 

      <!-- Overview Tab ends --> 


      <!-- Base Data Tab starts --> 

      <LinearLayout 
       android:id="@+id/baseDataTab" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:orientation="vertical" 
       android:padding="15dp" > 
      </LinearLayout> 

      <!-- Base Data Tab ends --> 


      <!-- Task Tab starts --> 

      <LinearLayout 
       android:id="@+id/taskTab" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:orientation="vertical" 
       android:padding="15dp" > 
      </LinearLayout> 

      <!-- Task Tab ends --> 


      <!-- Survey Tab starts --> 

      <LinearLayout 
       android:id="@+id/surveyTab" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:orientation="vertical" 
       android:padding="15dp" > 
      </LinearLayout> 

      <!-- Survey Tab ends --> 

     </FrameLayout> 
    </ScrollView> 
</LinearLayout> 

你有一些問題,你layout_height和width屬性。我改變了其中一些,這應該工作;-)

+0

工作像魔術... – 2015-02-06 12:32:11