tabhost布局中的ListView无法正确呈现

时间:2013-12-10 09:43:18

标签: android android-layout

我正在为Android 2.3.3开发应用程序。在一个活动中我使用tabhost,第一个选项卡有一个分页器用于照片,第二个选项卡有一个列表,整个布局有一个背景图像。当我在我的虚拟机API lvl 18中测试我的应用程序时没有问题,当我在我的设备Android 2.3.6中测试它时,我遇到了问题。当我滚动列表时,它的背景变为白色,当我停止与它交互时,它的背景将返回到布局的背景。这是Android版本的问题吗?我可以做些什么来解决它吗?这是布局文件,以防万一你错过了。

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

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

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="5dp"
        android:layout_weight="1">


                <RelativeLayout
                    android:id="@+id/tab1"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="horizontal" >

                            <android.support.v4.view.ViewPager
                                android:id="@+id/pager"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent" />

                </RelativeLayout>               

                <RelativeLayout android:id="@+id/tab2"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="horizontal"
                    android:background="@drawable/panel_start" >

                          <ListView
                                android:id="@+id/videos"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_alignParentLeft="true"
                                android:layout_alignParentTop="true" >
                         </ListView>

                </RelativeLayout>





</FrameLayout> 

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0"
        android:layout_marginBottom="-4dp"/>

</LinearLayout>

1 个答案:

答案 0 :(得分:1)

ListView

尝试此行
android:cacheColorHint="@android:color/transparent"

通过使用这个你的背景停留