Search code examples
androidandroid-layoutfirebasefirebase-authenticationfirebaseui

Set logo size in Firebase UI


Is there anyway to set the size of the logo in Firebase UI so it doesn't completely fill the view?

AuthUI.getInstance().createSignInIntentBuilder()
                    .setProviders(Arrays.asList(
                        new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build(),
                        new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build()
                    ))
                    .setIsSmartLockEnabled(!BuildConfig.DEBUG)
                    .setTheme(R.style.AppTheme_NoActionBar)
                    .setLogo(R.mipmap.icon_hero_image)
                    .build(),
            RC_SIGN_IN

Solution

  • Put the following in your styles.xml file, this will work with the setLogo method. This will style the logo so add/change items in the style however you would like:

    <style name="FirebaseUI.AuthMethodPicker.Logo">
            <item name="android:layout_width">wrap_content</item>
            <item name="android:layout_height">wrap_content</item>
            <item name="android:layout_gravity">center</item>
            <item name="android:padding">24dp</item>
    </style>