Как настроить кнопки входа в facebook и google

Я пытаюсь создать приложение, в котором пользователи могут зарегистрироваться с помощью учетной записи Google или Facebook. Я также хочу сделать свое приложение чистым и простым, поэтому мне не нужны кнопки входа по умолчанию. Я наткнулся на страницу входа 9gag, и мне понравилось то, что они сделали. может кто подскажет как сделать такие же кнопки?

введите здесь описание изображения

это мой код:

        <RelativeLayout
        android:id="@+id/btnFaceBookLogin"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:background="@color/facebook_blue">


      <ImageView
         android:id="@+id/facebook_icon"
         android:layout_width="30dp"
         android:layout_height="30dp"

         android:layout_alignParentLeft="true"
         android:layout_centerVertical="true"
         android:layout_marginLeft="11dp"
         android:contentDescription="@string/write_title"
         android:src="@drawable/com_facebook_inverse_icon" />


     <LinearLayout
         android:layout_width="1dp"
         android:layout_height="35dp"
                      android:layout_centerVertical="true"

         android:layout_alignTop="@+id/facebook_icon"
         android:layout_toRightOf="@+id/facebook_icon"
         android:layout_marginLeft="4dp"
         android:background="@android:color/darker_gray"
         android:orientation="vertical" >
     </LinearLayout>

    </RelativeLayout>

person digitalmidges    schedule 03.01.2014    source источник
comment
просто создайте кнопки и установите фон для какого-либо изображения.   -  person Kanwaljit Singh    schedule 03.01.2014


Ответы (1)


Попробуй это-

<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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <ImageView
        android:id="@+id/facebook"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="24dp"
        android:src="@drawable/ans"/>

    <ImageView
        android:id="@+id/Google"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/facebook"
        android:src="@drawable/ans" />

    <EditText
        android:id="@+id/userName"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/Google"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="18dp"
        android:ems="10"
        android:inputType="textPersonName" >

        <requestFocus />
    </EditText>

    <EditText
        android:id="@+id/password"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/userName"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="34dp"
        android:ems="10"
        android:inputType="textPersonName" />

    <Button
        android:id="@+id/button1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/password"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="34dp"
        android:text="Sign In" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/button1"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="21dp"
        android:text="Forget Pass" 
        android:gravity="center"/>

</RelativeLayout>
person Kanwaljit Singh    schedule 03.01.2014
comment
Я использую изображение с размерами 480 * 60. Работает нормально. - person Kanwaljit Singh; 03.01.2014