本文整理匯總了Java中android.widget.RatingBar.setAccessibilityLiveRegion方法的典型用法代碼示例。如果您正苦於以下問題:Java RatingBar.setAccessibilityLiveRegion方法的具體用法?Java RatingBar.setAccessibilityLiveRegion怎麽用?Java RatingBar.setAccessibilityLiveRegion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.RatingBar
的用法示例。
在下文中一共展示了RatingBar.setAccessibilityLiveRegion方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}