簡體   English   中英

Android,如何更改默認的facebook按鈕

[英]Android, how to change the default facebook button

我正在使用Facebook登錄。 我正在嘗試更改按鈕,但現在不起作用:我要將高度設為100dp。

登錄頁面xml:

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FFF">



        <ImageView android:layout_width="fill_parent"
                   android:layout_height="fill_parent"
                   android:src="@drawable/splash_screen"
                   android:scaleType="centerCrop"/>


        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <TextView
                android:text=""
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/label"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:textColor="#FFF"/>


            <com.gc.materialdesign.views.ButtonFlat
                android:id="@+id/bt_skip_login"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Skip Login"
                android:onClick="autoLogin"
                android:layout_above="@+id/login_button"
                android:layout_centerHorizontal="true"
                android:te

xtColor="#FFF"/>

        <com.facebook.login.widget.LoginButton
            xmlns:fb="http://schemas.android.com/apk/res-auto"
            android:id="@+id/login_button"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:scaleType="centerInside"
            style="@style/FacebookLoginButton"/>
    </RelativeLayout>

</RelativeLayout>

風格:

 <style name="FacebookLoginButton">
        <item name="android:layout_marginTop">10dp</item>
        <item name="android:layout_marginBottom">0dp</item>
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">90dp</item>
    </style>

我想看起來像這樣,但只是要填充寬度。

在此處輸入圖片說明

我已經更新了代碼,登錄bt仍然沒有變化

如果要根據需要放置自定義Facebook按鈕,最好的選擇是隱藏Facebook登錄按鈕並自定義本機Android按鈕,並將其放在原始Facebook登錄按鈕上方。 現在,單擊新定制的按鈕,調用loginbtn.performClick();。 通過這種方式,您還可以更改Button的文本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM