listView中ListItem Pressed的问题

找了好久,幸亏有一个哥们问了,类似的问题,这个主要用自定义的layout,包裹来切断事件链。


我也是遇到了这个问题,最后看的这篇文章,http://stackoverflow.com/questions/3858220/gallery-adapterview-child-drawable-state,在外层包一个自定义的Layout,并重写setpressed方法,方法里面就一句话:super.setPressed(false);即可

参考1:http://topic.csdn.net/u/20110816/19/31c5acab-f632-4a14-9835-d3ec3e4b48c9.html

参考2:http://stackoverflow.com/questions/3858220/gallery-adapterview-child-drawable-state


public class UC_LinearLayout extends LinearLayout {

	public UC_LinearLayout(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}

	public UC_LinearLayout(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void setPressed(boolean pressed) {
		// TODO Auto-generated method stub
		super.setPressed(false);
	}
}


你可能感兴趣的:(c,ListView,layout,Class,Constructor)