Home » Android » android – List item becomes unclickable if contains a RatingBar?

android – List item becomes unclickable if contains a RatingBar?

Posted by: admin June 15, 2020 Leave a comment

Questions:

I have used custom listview and custom rating bar.

If I add that custom RatingBar as child to the List item, the List Item becomes unclickable.

If i remove that Ratingbar view then it becomes clickable .

I used custom rating bar. here is the link.

Can anyone help me to solve this problem?

How to&Answers:

If you want your rating bar to perform rating you can add

 android:focusable="false"
 android:focusableInTouchMode="false"

to view of your row.xml

If you want a static rating bar holding its rate you can give setIsIndicator(boolean isIndicator)

ratingbar.setIsIndicator(true);

in your Adapter class.

Answer:

Ok. I’m able to do it finally.
In adapter class put fallowing

RatingBar ratingBar=(RatingBar)view.findViewById(R.id.ratingBarSummaryChild);

ratingBar.setFocusable(false);

return view;

Answer:

set android:focusable=”false” for rating bar

Answer:

Set RatingBar propertiesa
Focusable = false;
Clickable = false;