I tried to use the following style
<style name= "AuthStyle">
<item name="android:windowBackground">@drawable/culture</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
and then I applied the above style here:
startActivityForResult(AuthUI.getInstance()
.createSignInIntentBuilder()
.setProviders(AuthUI.EMAIL_PROVIDER,
AuthUI.FACEBOOK_PROVIDER,
AuthUI.GOOGLE_PROVIDER)
.setTheme(R.style.AuthStyle)
.build()
,1);
However,the title bar is still being displayed. Any suggestions on how to remove / hide it will be appreciated
Firebase UI overrides/ignores the removal of the action bar/app bar in the theme, so we have to cheat. In styles.xml
:
<style name="AppThemeFirebaseAuth" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:actionBarStyle">@style/FirebaseAuthActionBarStyle</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="FirebaseAuthActionBarStyle" parent="Widget.AppCompat.ActionBar">
<item name="android:background">@color/white</item>
</style>
(or rather than @color/white
, whatever your background colour.)
Where you start the activity for sign in:
Intent signInIntent = AuthUI.getInstance().createSignInIntentBuilder()
.setProviders(Arrays.asList(
new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build(),
new AuthUI.IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER).build()))
.setTheme(R.style.AppThemeFirebaseAuth)
.setLogo(R.drawable.logo)
.setIsSmartLockEnabled(!BuildConfig.DEBUG)
.build();
Keep in mind that in future releases of Firebase UI, the action bar/app bar might become useful or required, so this is a bit dangerous.
As of firebase ui version 4.3.1, the following code is enough to hide tiltebar, no need to do tricks with background color:
<style name="AppThemeFirebaseAuth" parent="android:Theme.Light.NoTitleBar">
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
just reference the style when creating AuthUI instance
// Choose authentication providers
List<AuthUI.IdpConfig> providers = Arrays.asList(
new AuthUI.IdpConfig.PhoneBuilder().build());
AuthUI.createSignInIntentBuilder()
.setAvailableProviders(providers)
.setTheme(R.style.AppThemeFirebaseAuth)
.build(),
Tested in android 4.4.2 and android 9 (Nexus emulators)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With