大家做滚动时要显示选中项,使他高亮,但该项失去焦点回滚,高亮就消失。网上好多关于这个的问题,但是都是做到一半或解决了就不回复的帖子,我的解决办法。
定义两个全部变量
public static int positionSelect = -1;//当前选中item
private
public static View newView = null;
onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3){
positionSelect = arg2;
if (oldView == null) {
if(newView!=null){
}
在适配器中
getview(int position, View convertView, ViewGroup parent){
if (AnimatedSizingGallery.positionSelect == position) {
}
我用两个View解决的,如果有朋友有更好的办法,麻烦给我留言,不想想了,我比较懒。