0

I have a LoginActivity screen with three buttons, pic is attached below:

enter image description here

When zooming in on the picture you can notice that there is a black fading shadow behind the button for google sign in. I need to add this to the other 2 buttons below the google sign ?

My codes are:

LoginActivity.xml

<com.google.android.gms.common.SignInButton
android:id="@+id/sign_in_button"
android:layout_width="260dp"
android:layout_height="35dp"

android:layout_marginTop="41dp"
android:layout_below="@+id/app_name"
android:layout_centerHorizontal="true" />

<com.facebook.login.widget.LoginButton
android:id="@+id/login_button"
android:layout_width="255dp"
android:layout_height="60dp"
android:textColor="#ffffff"
android:layout_marginTop="45dp"

android:layout_alignTop="@+id/sign_in_button"
android:layout_centerHorizontal="true" />

<Button
android:id="@+id/sign_in"
android:layout_width="260dp"
android:layout_height="35dp"
android:textSize="13dp"
android:text="Sign In"
android:textColor="@color/white"
android:textAllCaps="false"
android:background="@drawable/button_selector"
android:layout_below="@+id/login_button"
android:layout_alignLeft="@+id/sign_in_button"
android:layout_alignStart="@+id/sign_in_button"
android:layout_marginTop="33dp" />

button_selector drawable used for the last button:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">

            <stroke android:width="4dp" android:color="#b9706f" />

        </shape>
    </item>

    <item
        android:left="0dp"
        android:right="0dp"
        android:top="0dp"
        android:bottom="2dp">
        <shape xmlns:android="http://schemas.android.com/apk/res/android">
            <stroke android:width="3dp" android:color="#ffffff" />
        </shape>
    </item>
</layer-list>

Is there any way i can achieve this? Please suggest on what I am doing wrong because I tried the button_selector thing but it just didnt give me the perfect shadow.

Saim Mahmood
  • 426
  • 2
  • 12

2 Answers2

0

Trying adding shadow properties such as:

android:shadowColor="#000"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="5"
BR89
  • 716
  • 1
  • 6
  • 23
0

Why dont you try AppCompactButton it has support to handle shadows for non-material (pre-lollipop) devices to. It has some default eleveation. But you can always override this method. Dont forget to use app as the namespace.

MadScientist
  • 2,134
  • 14
  • 27