Customer ListView的行为不符合预期

时间:2011-02-04 03:45:51

标签: android listview

出于某种原因,我的自定义列表视图看起来不像大多数。此时它是一个单一的TextView(我稍后添加更多),但有两个问题。

1)所选项目仅选择内部TextView,而不是整个View行(为什么?)。

2)滚动页面时,View TextViews全黑。这只发生在滚动事件期间。

以下是相关观点。在主要活动中:

<ListView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:background="#ffffff"
        android:id="@+id/chapterList"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent">    

章节列表(个别项目)。

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/widget44"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingTop="5px"
    android:paddingBottom="5px"
    android:gravity="center_horizontal">
<TextView
    android:id="@+id/chapter_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textColor="#000000"
    android:textColorHighlight="#656565"></TextView>
</LinearLayout>

1 个答案:

答案 0 :(得分:0)

检查以下链接。在这里我提到了一个完整的代码来正确使用listview。 使用这个我们可以实现任何listview行为。我们也可以嵌入动画。

Change ListView background - strange behaviour

希望这有帮助:)

相关问题