I have a ListView that uses different XML files to create Views and make items out of. One of these XML files contains a RatingBar. Everything displays and looks excellent
The reason for setOnClickListener()
not working is that RatingBar
overrides onTouchEvent()
(actually its super class, AbsSeekBar
, does) and never let View
take care of it, so View#performClick()
is never called (which would have called the OnClickListener
).
Two possible workarounds:
RatingBar
and override onTouchEvent()
OnTouchListener
instead, like so:
ratingBar.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP) { // TODO perform your action here } return true; }
HTH, Jonas