简体   繁体   中英

How do I set editable property of rating bar to false

How should I set the editable property of rating bar to false ? I tried the following but it doesn't work:

holder.rb=(RatingBar)convertView.findViewById(R.id.ratingBar1);
holder.rb.setActivated(false);

To disactivate view use :

holder.rb=(RatingBar)convertView.findViewById(R.id.ratingBar1); 
holder.rb.setEnable(false)

Try holder.rb.setEnabled(false); or holder.rb.setIsIndicator(true); instead. both of them will work.

try this in your xml : android:isIndicator="true"

or this in java : holder.rb.setIsIndicator(true);

I guess you want your rating bar be unchangeable by user. If yes use the code i've mentioned above. But if you just want to enable or disable your rating bar you can use this line:

holder.rb.setEnabled(false);

just add android:isIndicator="true" in your xml! thats it!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM