This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lv.setOnTouchListener(new ListView.OnTouchListener() { | |
@Override | |
public boolean onTouch(View v, MotionEvent event) { | |
int action = event.getAction(); | |
switch (action) { | |
case MotionEvent.ACTION_DOWN: | |
// Disallow ScrollView to intercept touch events. | |
v.getParent().requestDisallowInterceptTouchEvent(true); | |
break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected static class ViewHolderProductList { | |
// I added a generic return type to reduce the casting noise in client | |
// code | |
@SuppressWarnings("unchecked") | |
public static <T extends View> T get(View view, int id) { | |
SparseArray<View> viewHolder = (SparseArray<View>) view.getTag(); | |
if (viewHolder == null) { | |
viewHolder = new SparseArray<View>(); | |
view.setTag(viewHolder); | |
} |