有点时候咱们须要在listview上绘制一些自定义的界面,那么这时候原生的点击高亮就显得不少余。 {<1>}html
###解决方案android
放狗去网上搜了一圈以后发现能够经过修改listview的配置进行去除。ide
原来的代码:优化
<ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:divider="@null" android:background="#fff"
修改后的代码:spa
<ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:divider="@null" android:background="#fff" android:listSelector="@android:color/transparent" android:cacheColorHint="@android:color/transparent" />
###分析code
咱们能够在AbsListView的文档中能够看到:xml