Smiley Rating bar 您好,我刚刚开始使用android,并且尝试使用笑脸评分栏,我将其添加到我的项目中, 我的问题是:
1-获取当前选择(用户的选择)我阅读了git上的说明,但我不知道如何获得用户选择。 2-将选择或用户选择发送到电子邮件地址,而无需打开电子邮件应用程序(直接发送)。
答案 0 :(得分:0)
通过smileRatingBar = findViewById(R.id.smile_rating_bar_id);
从Java类中的xml绑定视图
那么您需要为其添加侦听器:
smileRatingBar.setOnSmileySelectionListener(new SmileRating.OnSmileySelectionListener() {
@Override
public void onSmileySelected(@BaseRating.Smiley int smiley, boolean reselected) {
// reselected is false when user selects different smiley that previously selected one
// true when the same smiley is selected.
// Except if it first time, then the value will be false.
switch (smiley) {
case SmileRating.BAD:
Log.i(TAG, "Bad");
break;
case SmileRating.GOOD:
Log.i(TAG, "Good");
break;
case SmileRating.GREAT:
Log.i(TAG, "Great");
break;
case SmileRating.OKAY:
Log.i(TAG, "Okay");
break;
case SmileRating.TERRIBLE:
Log.i(TAG, "Terrible");
break;
}
}
});