2017-03-05 102 views
0

我有三个按钮的LoginActivity屏幕,PIC连接如下:按钮与衰落阴影的Android

enter image description here

当在画面放大,你可以看到,有按钮后面的褪黑影子为谷歌登录。我需要将此添加到谷歌标志下面的其他2个按钮?

我的代码是:

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绘制用于最后一个按钮:

<?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> 

有什么办法,我可以做到这一点?请建议我做错了什么,因为我尝试了button_selector的东西,但它没有给我完美的影子。

回答

0

尝试添加阴影属性,如:

android:shadowColor="#000" 
android:shadowDx="0" 
android:shadowDy="0" 
android:shadowRadius="5" 
+0

好吧,让我试试吧...... –

+0

这工作的最后一个按钮,但不是为Facebook按钮 –

+0

嗯这可能只是一个Facebook的具体项目然后。让我看看更多 – BR89

0

你为什么不尝试AppCompactButton它有支持,以处理非物质性(预棒棒糖)设备的阴影。它有一些默认的提示。但是你总是可以重写这个方法。不要忘记使用app作为命名空间。

+0

检查链接为doc [这里](https://developer.android的.com /参考/机器人/支撑/ V7 /插件/ AppCompatButton.html) – MadScientist