2011-09-09 17 views
0

私はListContactをタブコントネットとして割り当てています。すべて正常に動作していますが、リスト項目のすべての結果を確認することはできません。私は2番目のアイテムの半分にしか表示されていない、2番目のアイテムのみを表示しています。私のリストには10​​0個以上のアイテムが含まれています。 推測できますか?Android:リストビュー内のTabHost

+++++ EDIT ++++

Tab view Layout: 
================ 

<?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:background="@drawable/bg" android:layout_height="fill_parent"> 

    <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:orientation="vertical" 
      android:layout_width="fill_parent" android:layout_height="fill_parent"> 
      <View android:layout_width="fill_parent" android:layout_height="0.5dip" 
       android:background="#000" /> 
      <TabWidget android:id="@android:id/tabs" 
       android:layout_width="fill_parent" android:layout_height="wrap_content" 
       android:layout_marginLeft="0dip" android:layout_marginRight="0dip" /> 
      <View android:layout_width="fill_parent" android:layout_height="2dip" 
       android:background="#696969" /> 
      <View android:layout_width="fill_parent" android:layout_height="2dip" 
       android:background="#000" /> 
      <ScrollView android:id="@+id/ScrollView01" 
       android:layout_width="fill_parent" android:layout_height="fill_parent"> 
       <FrameLayout android:id="@android:id/tabcontent" 
        android:layout_width="fill_parent" android:layout_height="wrap_content"> 

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


Tab Activity: 
============= 
onCreate(): 

     mTabHost = (android.widget.TabHost) findViewById(android.R.id.tabhost); 
     mTabHost.setup(getLocalActivityManager()); 
     mTabHost.getTabWidget().setDividerDrawable(R.drawable.tab_divider); 

     Intent list1Intent = new Intent(LIST1);  
     View tabview1 = createTabView(mTabHost.getContext(), "Tab1"); 
     mTabHost.addTab(mTabHost.newTabSpec("tab1").setIndicator(tabview1) 
       .setContent(new Intent(list1Intent))); 

     View tabview2 = createTabView(mTabHost.getContext(), "Tab2"); 
     mTabHost.addTab(mTabHost.newTabSpec("tab2").setIndicator(tabview2) 
       .setContent(commentsIntent));        
     mTabHost.setCurrentTab(0);  


LIST1 layout: 
============= 
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" android:layout_height="fill_parent" 
    android:background="@drawable/bg" android:orientation="vertical" 
    android:id="@+id/rootView"> 

    <TextView android:layout_width="wrap_content" 
     android:layout_height="wrap_content" android:id="@+id/cs_list_empty" 
     android:text="No Data"></TextView> 

    <ListView android:id="@+id/android:list" android:layout_width="fill_parent" 
     android:layout_height="fill_parent" android:cacheColorHint="#00000000" 
     android:divider="#E6E8E9" android:dividerHeight="2dip" 
     android:clickable="false" android:choiceMode="none" android:focusable="false" /> 

</LinearLayout> 

おかげで、 ヴェンカトPapana

+0

リストビューをタブホストの外に置くと、すべてのアイテムが表示されますか? – blessenm

+0

はい@blessenm、tabhostの外でうまく動作しています。 –

+0

ログにエラーがある場合は、それを入れてください。または、あなたのコードを入れてください。 – blessenm

答えて

1

それはすでにスクロール実装し、scrollviewが最適化をinteruptうとしてあなたはListActivityでscrollviewを使用しないでくださいリストの活動のために作られました。

これは、全体の残りのスペースを埋めるためでframeLayoutを行います

<FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" 
    android:layout_height="0dip" android:layout_weight="1.0"/> 

としてtabcontentのでframeLayoutを行います。

+0

ありがとうございます、それは私のリストビューのために働いていますが、私のタブの1つが複数のビュー(リストビューではない)を持つ長い線形レイアウトを含む場合、私はスクロールに問題があります。この問題を解決する方法を教えてください。ありがとうございます –

+0

こんにちは@blesenm、私の前のコメントを無視してください。私は、スクロールビューの中に直線レイアウトを配置することで線形レイアウトのスクロールを修正しました。以下のような:<! - TAB1(ないリストビュー) - > \t \t \t <のLinearLayout> \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t <のLinearLayout> \t \t \t \t \t \t \t \t <! - TAB2(リストビュー) - > \t \t \t \t <のLinearLayout> \t \t \t \t \t \t ' –

関連する問題