如何将评级栏的可编辑属性设置为false

时间:2015-02-09 10:23:14

标签: android

如何将评级栏的可编辑属性设置为false? 我尝试了以下但是它不起作用:

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

4 个答案:

答案 0 :(得分:5)

停用视图使用:

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

答案 1 :(得分:3)

请尝试holder.rb.setEnabled(false);holder.rb.setIsIndicator(true);。 他们俩都会工作。

答案 2 :(得分:3)

在xml:android:isIndicator="true"

中尝试此操作

或者这在java中:holder.rb.setIsIndicator(true);

我想你希望你的评级栏不能被用户改变。如果是,请使用上面提到的代码。 但是,如果您只想启用或禁用评级栏,可以使用以下行:

holder.rb.setEnabled(false);

答案 3 :(得分:0)

只需在xml中添加android:isIndicator =“ true”!就是这样!

相关问题