【发布时间】:2011-10-28 11:30:47
【问题描述】:
我有一个列表视图,当我触摸它们时,它在项目上显示为黄色。我所做的不同之处是更改该 listview xml 中的背景图像,现在它不再向我显示黄色
这里是代码
列表视图xml,它只是一个带有背景图像的文本视图:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="24sp"
android:textColor="#000000"
android:background="@drawable/bglistitem"
android:gravity="center_vertical|center_horizontal">
</TextView>
另一个布局中调用它的地方
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="24sp"
android:textColor="#000000"
android:background="@drawable/bglistitem"
android:gravity="center_vertical|center_horizontal">
</TextView>
这里是代码:
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1,int arg2, long arg3) {}
});
正如你在上面看到的,我从来没有做任何会改变选择突出显示的默认行为的事情,为什么现在会有所不同,也许你看到了我没有看到的东西?
【问题讨论】:
标签: java android listview selection highlighting