gpt4 book ai didi

android - 如何在 android 中应用 Material Design Facebook 按钮

转载 作者:行者123 更新时间:2023-11-29 14:30:55 25 4
gpt4 key购买 nike

我正在使用 compile 'com.facebook.android:facebook-android-sdk:4.7.0'和:

<com.facebook.login.widget.LoginButton
android:id="@+id/tutorial_button_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="16dp"
/>

但是这个按钮看起来很丑:Example

有没有办法让它看起来物化或者更酷一些?

最佳答案

我试图模仿 Google's Material Design specifications 中描述的 Material 凸起按钮 ,这是我能做的: Facebook login button that looks like Material raised button

为了涵盖 pre-lollipop 版本,我使用了 CardView 支持库的属性:

 compile 'com.android.support:cardview-v7:23.1.0'

我将 LoginButton 放在 CardView 中:

<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="6dp"
card_view:cardBackgroundColor="#ffd9d9d9"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="6dp">

<com.facebook.login.widget.LoginButton xmlns:fb="http://schemas.android.com/apk/res-auto"
android:id="@+id/login_button"
android:layout_width="190dp"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:paddingBottom="12dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="12dp"
android:textAllCaps="true"
android:textColor="@android:color/white"
fb:com_facebook_login_text="log in with facebook"
fb:com_facebook_logout_text="log out from facebook" />

</android.support.v7.widget.CardView>

为了从原始登录按钮中删除小 f 图标,我将其添加到 java LoginButton 实例中:

mButtonLogin.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);

关于android - 如何在 android 中应用 Material Design Facebook 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33402623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com