title: Android rateBar is getting cut off in my xml
body: <p>I have an android rateBar that gets injected into my XML when a user adds a beer to their portfolio. When the ratebar shows up. I am trying to scale it so I can make it fit, on half the screen. When I insert it, looks like it should have room but gets cut off before reaching the edge of the screen:</p>
  
  <p><img src="https://i.stack.imgur.com/tF89S.png" alt="enter image description here"></p>
  
  <p>The xml for my activity is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  
      &lt;LinearLayout 
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical" &gt;
  
  
          &lt;FrameLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="6dp"
                  android:layout_marginRight="6dp"
                  android:layout_marginTop="4dp"
                  android:layout_marginBottom="4dp"
                  android:orientation="vertical"
                  android:background="@drawable/bg_card"&gt;
  
  
  
                  &lt;!-- Card Contents go here --&gt;
                  &lt;TextView
                      android:id="@+id/beerTitle"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:ems="10"
                      android:textSize="20sp"
                      android:textStyle = "bold"
                      android:padding="5dip"
                      &gt;
                  &lt;/TextView&gt;
  
                  &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="horizontal"&gt;
  
                      &lt;ImageView android:id="@+id/image"
                          android:layout_height="fill_parent"
                          android:layout_width="fill_parent"
                          android:layout_margin="10dip"
                          android:layout_weight="1"/&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:orientation="vertical"
                          android:layout_weight="1"&gt;
  
                          &lt;TextView
                              android:id="@+id/beerBreweryTitle2"
                              android:layout_width="fill_parent"
                              android:layout_height="wrap_content"
                              android:ems="10"
                              android:textSize="10sp"
                              android:text="From: "
                              android:textStyle = "bold"
                              android:padding="5dip"
  
                              &gt;&lt;/TextView&gt;
  
                          &lt;TextView
                              android:id="@+id/beerBreweryName"
                              android:layout_width="fill_parent"
                              android:layout_height="wrap_content"
                              android:ems="10"
                              android:textSize="15sp"
                              android:textColor="@color/orange"
                              android:textStyle = "bold"
                              android:padding="5dip"
                              android:onClick="viewBrewery"
                              android:clickable="true"
  
                              &gt;&lt;/TextView&gt;
  
                          &lt;TextView
                              android:id="@+id/beerStyleTitle2"
                              android:layout_width="fill_parent"
                              android:layout_height="wrap_content"
                              android:ems="10"
                              android:textSize="10sp"
                              android:text="Style: "
                              android:textStyle = "bold"
                              android:padding="5dip"
  
                              &gt;&lt;/TextView&gt;
  
  
                          &lt;TextView
                              android:id="@+id/beerStyleName"
                              android:layout_width="fill_parent"
                              android:layout_height="wrap_content"
                              android:ems="10"
                              android:textSize="15sp"
                              android:textColor="@color/orange"
                              android:textStyle = "bold"
                              android:padding="5dip"
                              android:onClick="viewStyle"
                              android:clickable="true"
  
                              &gt;&lt;/TextView&gt;
  
  
                          &lt;TableLayout
  
                              android:id="@+id/tableLayout1"
                              android:layout_width="match_parent"
                              android:layout_height="match_parent"
                              android:layout_gravity="center_horizontal"
                              android:shrinkColumns="*"
                              android:stretchColumns="*"&gt;
  
                              &lt;TableRow
                                  android:id="@+id/tableStatTitles"
                                  android:layout_width="match_parent"
                                  android:layout_height="wrap_content"
  
                                  android:padding="5dip" &gt;
  
                                  &lt;TextView
                                      android:id="@+id/abvTitle"
                                      android:text="ABV"
                                      android:gravity="center"
                                      android:textStyle = "bold"
                                      android:textSize="10sp"
                                      android:layout_weight="1"
  
                                      &gt;&lt;/TextView&gt;
  
                                  &lt;TextView
                                      android:id="@+id/IBUTitle"
                                      android:text="IBU"
                                      android:gravity="center"
                                      android:textStyle = "bold"
                                      android:textSize="10sp"
                                      android:layout_weight="1"
  
                                      &gt;&lt;/TextView&gt;
  
                                  &lt;TextView
                                      android:id="@+id/glassTitle"
                                      android:text="Glass"
                                      android:gravity="center"
                                      android:textStyle = "bold"
                                      android:textSize="10sp"
                                      android:layout_weight="1"
                                      android:layout_width="wrap_content"
                                      &gt;&lt;/TextView&gt;
  
  
  
  
                              &lt;/TableRow&gt;
  
                              &lt;TableRow
                                  android:id="@+id/tableStat"
                                  android:layout_width="match_parent"
                                  android:layout_height="wrap_content"
  
                                  android:padding="5dip" &gt;
  
                                  &lt;TextView
                                      android:id="@+id/abv"
                                      android:text=""
                                      android:gravity="center"
                                      android:textSize="15sp"
                                      android:layout_width="wrap_content"
                                      &gt;&lt;/TextView&gt;
  
                                  &lt;TextView
                                      android:id="@+id/IBU"
                                      android:text=""
                                      android:gravity="center"
                                      android:textSize="15sp"
                                      android:layout_width="wrap_content"
                                      &gt;&lt;/TextView&gt;
  
                                  &lt;TextView
                                      android:id="@+id/glass"
                                      android:text=""
                                      android:gravity="center"
                                      android:textSize="15sp"
                                      android:layout_width="wrap_content"
                                      &gt;&lt;/TextView&gt;
  
  
                              &lt;/TableRow&gt;
  
                          &lt;/TableLayout&gt;
  
  
  
  
                      &lt;/LinearLayout&gt;
  
  
                  &lt;/LinearLayout&gt;
  
  
  
              &lt;/LinearLayout &gt;
  
          &lt;/FrameLayout&gt;
  
  
  
  
          &lt;FrameLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="6dp"
                  android:layout_marginRight="6dp"
                  android:layout_marginTop="4dp"
                  android:layout_marginBottom="4dp"
                  android:orientation="vertical"
                  android:background="@drawable/bg_card"&gt;
  
  
  
                  &lt;!-- Card Contents go here --&gt;
  
  
                  &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="horizontal"&gt;
  
                  &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="vertical"
                      android:layout_weight="2"&gt;
  
  
  
                      &lt;TextView
                          android:id="@+id/textView1"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="Average Rating: "
                          android:textStyle = "bold"
                          android:textSize="15sp"
                          /&gt;
  
                      &lt;TextView
                          android:id="@+id/beerRating"
                          android:layout_width="fill_parent"
                          android:layout_height="wrap_content"
                          android:text=""
                          android:textSize="20sp"
                          /&gt;
  
                      &lt;/LinearLayout&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:orientation="vertical"
                          android:layout_weight="1"&gt;
  
                          &lt;TextView
                              android:id="@+id/yourPortfolio"
                              android:textStyle = "bold"
                              android:layout_width="fill_parent"
                              android:layout_height="wrap_content"
                              android:ems="10"
                              android:textSize="15sp"
                              android:text="Your Portfolio:"
                              android:padding="5dip"
                              &gt;&lt;/TextView&gt;
  
                          &lt;LinearLayout
                              android:id="@+id/addBeerLayout"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:orientation="vertical" &gt;
  
                          &lt;/LinearLayout&gt;
  
                          &lt;/LinearLayout&gt;
  
                  &lt;/LinearLayout&gt;
  
  
  
  
              &lt;/LinearLayout &gt;
  
          &lt;/FrameLayout&gt;
  
  
  
  
          &lt;FrameLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="6dp"
                  android:layout_marginRight="6dp"
                  android:layout_marginTop="4dp"
                  android:layout_marginBottom="4dp"
                  android:orientation="vertical"
                  android:background="@drawable/bg_card"&gt;
  
  
  
                  &lt;!-- Card Contents go here --&gt;
                  &lt;TextView
                      android:id="@+id/beerDescriptionTitle"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:ems="10"
                      android:padding="5dip"
                      android:text="Description:"
                      android:textSize="15sp"
                      android:textStyle="bold" &gt;
                  &lt;/TextView&gt;
                  &lt;TextView
                      android:id="@+id/beerDescription"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:ems="10"
                      android:textSize="15sp"
                      android:padding="5dip"
  
                      &gt;&lt;/TextView&gt;
  
  
  
  
              &lt;/LinearLayout &gt;
  
          &lt;/FrameLayout&gt;
  
          &lt;FrameLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="6dp"
                  android:layout_marginRight="6dp"
                  android:layout_marginTop="4dp"
                  android:layout_marginBottom="4dp"
                  android:orientation="vertical"
                  android:background="@drawable/bg_card"&gt;
  
  
  
                  &lt;!-- Card Contents go here --&gt;
                  &lt;Button
                      android:id="@+id/buttonTasteTag"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:padding="5dip"
                      android:text="Taste Profile"
                      android:onClick="viewTasteTags"
  
                      /&gt;
  
  
  
  
              &lt;/LinearLayout &gt;
  
          &lt;/FrameLayout&gt;
  
  
  
  
  
  
  
  &lt;/LinearLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>And the rateBar that gets added into the xml has an xml file like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:onClick="rateDialog"&gt;
  
      &lt;RatingBar
          android:id="@+id/beerRatingBar"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:numStars="5"
          android:stepSize="1.0"
          android:rating="0"
          android:onClick="addRateToDB"
          android:scaleX="0.5"
          android:scaleY="0.5"
           /&gt;
  
  
  
  
  &lt;/LinearLayout&gt;
  </code></pre>