今天,发现自己写的ListView的点击效果不见了,查了一下资料,整理下ListView的点击效果的修改。
1. 取消ListView的点击效果。
方法一:
直接在xml文件的ListView中添加这句:
android:listSelector="@android:color/transparent"
方法二:
在ListView的子布局的布局文件里添加背景色。
原理是遮挡自带的点击效果。
如:android:background=“#FFFFFF”
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orienta