2

I have kept both fb and google login on my app. The problem is that since fb uses its own class to create xml button, i can't match the height of it to my google button (android:layout_height is not applicable for fb button). I'm applying a customized image as background for both fb and google.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/login_page" >

<com.facebook.login.widget.LoginButton
    xmlns:facebook="http://schemas.android.com/apk/res-auto"
    android:id="@+id/authButton"
    style="@style/FacebookLoginButton"
    android:layout_width="220dp"
    android:layout_height="wrap_content"
    android:layout_above="@+id/OrTextView"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="2dp"
    android:ellipsize="marquee"
    android:gravity="center"
    android:paddingBottom="8dp"
    android:paddingTop="8dp"
    android:textSize="20sp"
    facebook:com_facebook_login_text="" />

 <TextView
        android:id="@+id/OrTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center_horizontal"
        android:layout_above="@+id/gmail_Login"
        android:layout_marginBottom="2dp"
        android:text="--- or ---"
        android:textColor="#ffffff"
        android:textSize="14sp" />

  <Button
        android:id="@+id/gmail_Login"
        style="@style/GmailLoginButton"
        android:layout_width="220dp"
        android:layout_centerHorizontal="true"
        android:ellipsize="marquee"
        android:gravity="center"
        android:textSize="20sp"
        android:layout_marginBottom="7dp"
        android:layout_above="@+id/textView1"
        android:layout_height="40dp" />


<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_above="@+id/termslink"
    android:text="By creating an account, you agree with our"
    android:textAppearance="?android:attr/textAppearanceSmall"
    android:textColor="@color/white"
    android:textSize="12sp"
    android:textStyle="bold"
     />

<TextView
    android:id="@+id/termslink"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:text="Terms and Conditions"
    android:textAppearance="?android:attr/textAppearanceSmall"
    android:textColor="@color/white"
    android:textSize="12sp"
    android:paddingBottom="5dp"
    android:textStyle="bold" />

Styles.xml:

<style name="FacebookLoginButton">
<item name="android:background">@drawable/facebook_signin</item>
<item name="android:layout_marginTop">10dp</item>
<item name="android:layout_gravity">center_horizontal</item>
</style>
<style name="GmailLoginButton">
    <item name="android:textSize">20sp</item>
    <item name="android:background">@drawable/gmail_login</item>
    <item name="android:layout_gravity">center_horizontal</item>
</style>
Abhishek
  • 43
  • 5

1 Answers1

1

This answer might help you with your problem

Community
  • 1
  • 1
ABM
  • 77
  • 13