2015-02-06 148 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