How to set up animation when the user selects an item in the list?
I create my own listview adapter to set even lines with a pink background and odd lines with a purple background. The only problem is that I'm not sure how to set up the animation for the user to click (“touch”) the item.
I was thinking about implementing OnTouchListener and changing the background to green when it is selected. BUT I have buttons inside the lines that can no longer work due to the implementation of OnTouchListener. It's true?
the code:
public class MyAdapter extends BaseAdapter {
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = mInflater.inflate(R.layout.your_layout, null);
...
} else {
}
convertView.setBackground(...);
return convertView;
}
}
source
share