本文整理汇总了Java中android.widget.RatingBar.setOnRatingBarChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java RatingBar.setOnRatingBarChangeListener方法的具体用法?Java RatingBar.setOnRatingBarChangeListener怎么用?Java RatingBar.setOnRatingBarChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.RatingBar
的用法示例。
在下文中一共展示了RatingBar.setOnRatingBarChangeListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EvaluationViewHolder
import android.widget.RatingBar; //导入方法依赖的package包/类
public EvaluationViewHolder(View view) {
super(view);
className = (TextView) view.findViewById(R.id.student_class);
examName = (TextView) view.findViewById(R.id.student_exam);
userAccountName = (TextView) view.findViewById(R.id.student_name);
ratingBar = (RatingBar) view.findViewById(R.id.ratingBar);
ratingBar.setOnRatingBarChangeListener(this);
}
示例2: onCreateView
import android.widget.RatingBar; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.session_feedback_frag, container, false);
mTitle = (TextView) rootView.findViewById(R.id.feedback_header_session_title);
mSpeakers = (TextView) rootView.findViewById(R.id.feedback_header_session_speakers);
mOverallFeedbackBar = (RatingBar) rootView.findViewById(R.id.rating_bar_0);
mSessionRelevantFeedbackBar = (NumberRatingBar) rootView.findViewById(
R.id.session_relevant_feedback_bar);
mContentFeedbackBar = (NumberRatingBar) rootView.findViewById(R.id.content_feedback_bar);
mSpeakerFeedbackBar = (NumberRatingBar) rootView.findViewById(R.id.speaker_feedback_bar);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// Helps accessibility services determine the importance of this view.
mOverallFeedbackBar.setImportantForAccessibility(RatingBar.IMPORTANT_FOR_ACCESSIBILITY_YES);
// Automatically notifies the user about changes to the view's content description.
mOverallFeedbackBar.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_ASSERTIVE);
}
// When the rating changes, update the content description. In TalkBack mode, this
// informs the user about the selected rating.
mOverallFeedbackBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
ratingBar.setContentDescription(
getString(R.string.updated_session_feedback_rating_bar_content_description, (int) rating));
}
});
rootView.findViewById(R.id.submit_feedback_button).setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View view) {
submitFeedback();
}
}
);
return rootView;
}