2012-07-20 146 views
0

目前我在簡單的Android應用我的工作,使用Tabhost,創建三個選項卡,並使用RelativeLayout的創建ListView的第一個標籤,但ListView中不可見的,所以我試圖設置的ListView背景顏色(白色),只顯示白色ListView未顯示,但結果相同,請幫助我,如何在Android中的Tabbar中設置列表視圖。ListView不會顯示在Android的Tabhost的RelativeLayout中?

由於提前

我想這

<?xml version="1.0" encoding="utf-8"?> 
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/tabhost" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

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

    <TabWidget android:id="@android:id/tabs" 
     android:layout_width="fill_parent" 
     android:layout_alignParentBottom = "true" 
     android:layout_height="wrap_content" 
    /> 

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




    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/tab1" 

    android:layout_width="fill_parent" 
    android:layout_height="200dip" > 

    <ListView 
     android:id="@+id/edittext01" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:background="#ffff" 
     android:paddingTop="10px" /> 

</RelativeLayout> 

回答

0

你真正需要,只要你想在他們之上,然後使用RelativeLayout的財產android:layout_above="id_of_FrameLayout_containing_ListView ",只要你想,顯示您的列表,根據標籤來指定ListView的位置。

而對於該項目,你添加正確添加ListView的檢查中的內容,如果使用AdapterClass繪製每個列表項..

希望這個解釋對你的作品...

+0

感謝您的回覆 – SampathKumar 2012-07-20 13:32:13

+0

燦ü請解釋ellaborately – SampathKumar 2012-07-20 13:36:04

+0

[Lisk1 ..使用的LinearLayout](http://joshclemm.com/blog/?p=59)和[鏈路2 .. usingRelativeLayout](http://www.edumobile.org/android/android-初學者教程/選項卡控制/) 希望你能從這些鏈接中得到你真正想要的東西... – MobileEvangelist 2012-07-20 13:43:37