how to get RatingBar value

前端 未结 9 2380
傲寒
傲寒 2021-02-13 18:55

how to read and display rating bar value

i[0] // should be selected value

private OnClickListener onclickbutton1 = new OnClickListener() {
    public void onCli         


        
9条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-13 19:37

    var ratingBar = findViewById(R.id.ratingBarid);
    var text1 = findViewById(R.id.textViewid)
    
    // rating bar click to show the text view
    
    ratingBar.setOnRatingBarChangeListener(object: RatingBar.OnRatingBarChangeListener{
    
        override fun onRatingChanged(ratingBar: RatingBar?, rating: Float, fromUser: Boolean) {
           // TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
            text1.text = "Rating bar result $rating"
        }
    })
    

提交回复
热议问题