當前位置: 首頁>>代碼示例>>Java>>正文


Java RatingBar.setOnRatingBarChangeListener方法代碼示例

本文整理匯總了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);
}
 
開發者ID:fga-gpp-mds,項目名稱:2017.1-Trezentos,代碼行數:9,代碼來源:EvaluationViewHolder.java

示例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;
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:43,代碼來源:SessionFeedbackFragment.java


注:本文中的android.widget.RatingBar.setOnRatingBarChangeListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。