相关疑难解决方法(0)

Android 2.3.3列表视图页脚背景

这个很奇怪.我有一个列表视图,它是相对布局的一部分.我已为此相对布局设置了背景,并使列表视图背景变为透明.

现在,一切都很好,直到今天早上.即使我的列表视图中只有一行,我也可以看到整个屏幕都覆盖了我的自定义背景.

然后,我获得了Verizon Motorola Droid X for 2.3.3的更新(之前为2.2).一旦更新,我再次启动我的应用程序,现在发生了什么.

如果我的列表视图只有一行,我看到它下面有一个白色区域而不是我的自定义背景.但如果它说100行并因此覆盖整个屏幕我将不会看到奇怪的白色背景.我的相对布局的宽度和高度设置为"fill_parent".

我在底部发布了我的XML.有没有其他人遇到过这个问题,或者我犯了一些非常愚蠢的错误.

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:background = "@drawable/background" 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <ListView   android:id = "@+id/listQueue"
                android:layout_width = "fill_parent"
                android:layout_height = "fill_parent"
                android:layout_below = "@id/homeScreenBanner"
                android:background="@android:color/transparent"
                android:divider="@drawable/separator"
                android:scrollingCache="false"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

编辑:

我想我找到了解决这个问题的方法:

将layout_height属性更改为wrap_content,它就像一个魅力.:)

更改后的行. android:layout_height = "wrap_content"

android android-widget android-layout android-listview

22
推荐指数
2
解决办法
6182
查看次数

列表视图背景在Droid 3上是灰色的

我有一个自定义背景的列表框.它在两侧显示一条带有黑色背景的细白线.适用于我所有的测试手机(Galaxy Captivate,Vibrant,Nexus 1,G Tablet,Archos 32,Droid).我刚刚有一个Droid 3进行测试,在这一款手机上,listview的背景没有任何项目是灰色的.列表项具有正确的黑色背景.

这是包含列表视图的布局.列表视图上方和下方都有白色背景文本框,列表视图的背景是可绘制的(我知道它叫做三个边框,但它只有两个边框).

<RelativeLayout
    android:layout_below="@id/divider01"
    android:layout_above="@id/save_current_button"
    android:id="@+id/profile_middle_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="3dip"
    android:orientation="vertical">
    <TextView  android:id="@+id/user_profile_row"
        android:text="@string/user_profiles_label"
        android:layout_alignParentTop="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:textColor="@android:color/black"
        android:background="@drawable/roundedtop"/>
    <TextView android:id="@+id/current_profile_name"
        android:layout_alignParentBottom="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:textColor="#2B497B"
        android:background="@drawable/roundedbottom"/>
    <ListView android:id="@id/android:list"
        android:layout_below="@id/user_profile_row"
        android:layout_above="@id/current_profile_name"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:paddingLeft="3dip"
        android:paddingRight="3dip"
        android:drawSelectorOnTop="false"
        android:background="@drawable/three_side_border"
        android:cacheColorHint="#ffffffff"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

这是可绘制的 - 这应该强制背景为黑色.

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
        <shape android:shape="rectangle">
            <solid android:color="#FFFFFFFF" />
        </shape>
    </item>

    <item android:left="3dp" android:right="3dp"> 
        <shape android:shape="rectangle">
            <solid android:color="#FF000000" />
        </shape>
    </item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)

我注意到在我的列表项xml中,我没有在我的颜色中指定alpha分层,所以我尝试在我的drawable上取下前导FF,但它出来了.

任何人都有任何想法,我可以解决这个问题?在一部漂亮的手机上看起来真的很难看.

谢谢,格雷格

android listview background

12
推荐指数
1
解决办法
3237
查看次数