我有一个列表视图,当我触摸它们时,它会显示项目上的黄色视图.所有我做的不同的是改变listview xml中的背景图像,现在它不再向我显示yellowtint
这是代码
列表视图xml,它只是一个带有背景图像的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>
Run Code Online (Sandbox Code Playgroud)
在另一个布局中调用它的位置
<?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>
Run Code Online (Sandbox Code Playgroud)
这是代码:
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1,int arg2, long arg3) {}
});
Run Code Online (Sandbox Code Playgroud)
正如你在上面所看到的,我从来没有做任何会改变选择突出显示的默认行为的东西,为什么现在会有所不同,也许你看到我看不到的东西?