title: Facebook SDK v4 LoginButton ignores XML customizations
body: <p>The new <a href="https://github.com/facebook/facebook-android-sdk" rel="nofollow noreferrer">Facebook SDK for Android (v4.0)</a> that was released recently caused strange behavior for a customized <a href="https://developers.facebook.com/docs/reference/android/current/class/LoginButton/" rel="nofollow noreferrer">LoginButton</a> I'm using. Below is a comparison of how the same XML is rendered in different SDK versions. </p>
  
  <p>The problem seems to be that the FB icon in SDK 4.x doesn't stretch properly to fit a custom-sized button, and at 4.0.1 the <code>android:layout_height</code> property is <em>ignored</em> altogether.</p>
  
  <p>My question is <strong>how do I make the button appear in SDK 4.x like it did in SDK 3.x?</strong> Both XML and Java solutions are perfectly acceptable.</p>
  
  <p>XML for SDK 3.x:</p>
  
  <pre><code>&lt;com.facebook.widget.LoginButton
          android:background="@color/com_facebook_blue"
          android:id="@+id/login_btn_facebook"
          android:layout_width="225dp"
          android:layout_height="50dp"
          android:layout_marginBottom="5dp"
          android:layout_marginTop="5dp"
          android:layout_gravity="center"
          android:onClick="onFacebookLoginClick"
              /&gt;
  </code></pre>
  
  <p>How it looks on SDK 3.x (screenshot taken on a OnePlus One, running CM11S):
  <img src="https://i.stack.imgur.com/1uHHY.png" alt="XML rendering when running with SDK v3.x"></p>
  
  <p>XML for SDK 4.x (the button's package was renamed + I had to change the width &amp; font a bit to match the g+ button):</p>
  
  <pre><code>&lt;com.facebook.login.widget.LoginButton
          android:background="@color/com_facebook_blue"
          android:id="@+id/login_btn_facebook"
          android:layout_width="221dp"
          android:layout_height="50dp"
          android:layout_marginBottom="5dp"
          android:layout_marginTop="5dp"
          android:layout_gravity="center"
          android:textSize="7pt"
          android:onClick="onFacebookLoginClick"
              /&gt;
  </code></pre>
  
  <p>How it looks on SDK 4.0 (Screenshot taken on a Genymotion Nexus 5, running unmodified 4.4.4):
  <img src="https://i.stack.imgur.com/ZD2KP.png" alt="enter image description here"></p>
  
  <p>How it looks on SDK 4.0.1 (Same Genymotion Nexus 5):
  <img src="https://i.stack.imgur.com/XNXCs.png" alt="enter image description here"></p>
  
  <h3>Additional information</h3>
  
  <ol>
  <li>Excerpt from the <a href="https://developers.facebook.com/docs/android/change-log-4.x#ver4_0_1" rel="nofollow noreferrer">4.0 -> 4.0.1 SDK change log</a>:</li>
  </ol>
  
  <blockquote>
    <p>Login button is updated to properly measure its size.</p>
  </blockquote>
  
  <ol start="2">
  <li><p>Related posts:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/18868594/custom-facebook-login-button-image-in-facebook-android-sdk-3-5">Custom Facebook login button image in Facebook Android SDK 3.5</a></li>
  </ul></li>
  <li><p>To support different screen sizes, above the login buttons I have a <a href="https://github.com/JakeWharton/ViewPagerIndicator" rel="nofollow noreferrer">ViewPagerIndicator</a> and a <a href="http://developer.android.com/reference/android/support/v4/view/ViewPager.html" rel="nofollow noreferrer">ViewPager</a> that is configured to take up all available vertical space which remains after positioning elements with defined height.</p>
  
  <p></p></li>
  </ol>