如何从 Facebook 登录 sdk 中删除 ProgressBar

Nat*_*ino 1 android android-progressbar progress-bar facebook-sdk-4.0

通过使用 android 实现 Facebook 登录,我需要将令牌发送到我的后端服务器,所以我想知道是否可以删除进度条并创建我自己的进度,在获取 Facebook 令牌并发送到我的服务器后处理。当我打电话时它出现:

LoginManager.getInstance().logInWithReadPermissions(Login.this,Arrays.asList("email"));
Run Code Online (Sandbox Code Playgroud)

Hed*_*deH 6

您可以像这样删除 Facebook 登录 ProgressBar:

在values/styles.xml添加以下样式:

<style name="Translucent" parent="Translucent.Base"/>

<style name="InvisibleProgress">
    <item name="android:visibility">gone</item>
</style>

<style name="Translucent.Base" parent="android:Theme.Translucent.NoTitleBar">
    <item name="android:progressBarStyle">@style/InvisibleProgress</item>
</style>
Run Code Online (Sandbox Code Playgroud)

在values-v21/styles.xml添加以下样式:

<style name="Translucent" parent="Translucent.Base">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>
Run Code Online (Sandbox Code Playgroud)

然后,在您的AndroidManifest.xml覆盖主题中FacebookActivity:

<manifest
  ...
  xmlns:tools="http://schemas.android.com/tools"
>

...

<activity
    android:name="com.facebook.FacebookActivity"
    android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:label="@string/app_name"
    android:theme="@style/Translucent"
    tools:replace="android:theme"
/>
Run Code Online (Sandbox Code Playgroud)

现在您将看不到 Facebook 进度条,您可以自己绘制 :)