title: How to align rating bar and a button in the middle of a layout
body: <p><img src="https://i.stack.imgur.com/F94Dr.png" alt="enter image description here" /></p>
  <p>I'm trying to combine the <code>RatingBar</code> and <code>Button</code> in one layout (either <code>RelativeLayout</code> or <code>LinearLayout</code>).
  The Ratingbar and Button always align on the top, and it has a long distance between the rating images with the button. (I tried to make them closer to each other, but the partical rating images covered by the button)</p>
  <p>How can I align the rating bar and button in the middle of the layout?
  I tried  layout_gravity` and it seems not to work for me.</p>
  <h3>test_layout.xml</h3>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;RelativeLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:layout_width=&quot;fill_parent&quot;
      android:layout_height=&quot;60dp&quot;
      android:layout_marginTop=&quot;15dp&quot;
      android:background=&quot;@color/white&quot;&gt;
  
      &lt;RatingBar style=&quot;@style/customRatingBar&quot;
                 android:id=&quot;@+id/ratingBar&quot;
                 android:layout_width=&quot;wrap_content&quot;
                 android:layout_height=&quot;wrap_content&quot;
                 android:layout_marginLeft=&quot;10dip&quot;
                 android:stepSize=&quot;0.5&quot;
                 android:numStars=&quot;5&quot;
                 android:rating=&quot;4.5&quot;
                 android:layout_alignParentLeft=&quot;true&quot;/&gt;
  
      &lt;Button
              android:layout_alignParentRight=&quot;true&quot;
              android:layout_marginRight=&quot;15dp&quot;
              android:id=&quot;@+id/btnSubmit&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;button&quot;
              android:textColor=&quot;@color/white&quot;
              android:background=&quot;@color/self_defined&quot;/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>