Android RatingBar showing more than 5 stars

后端 未结 5 1062
鱼传尺愫
鱼传尺愫 2021-02-12 19:04

I want to show a rating bar via an alert dialog in my android app. The problem I am facing is that depending upon the width of the screen, the ratingbar shows more than 5 stars(

5条回答
  •  梦谈多话
    2021-02-12 19:34

    Try to set max value for your RatingBar Like Below

    
    
        
    
    
    

    create an xml file in your layout file and set this as the content

    Change your showDialog function like this

    LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    View layout = inflater.inflate(R.layout.***your_xml_name***));
    editor.setView(layout);
    editor.show();
    

提交回复
热议问题