Android RatingBar showing more than 5 stars

后端 未结 4 1280
渐次进展
渐次进展 2021-02-12 19:09

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(

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-12 19:33

    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();
    

提交回复
热议问题