I don’t want to take more time for this. without vesting your time direct i write the code of create rating bar in linear view with steps.

1. First open your sketchwere ide and add a button and a linear_view.

2. After that go to onButton click event and add add source directly block and write the code given below.

 RatingBar tp = new RatingBar(this); linear1.addView(tp);

3. Now run your project.