2012-07-20 101 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