如何自定义Firebase身份验证UI [英] How to customize firebase auth ui

查看:136
本文介绍了如何自定义Firebase身份验证UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过号码验证使用Firebase Auth Ui.我对我需要更改国家微调框的下拉菜单项的文本和背景颜色有一些要求.我正在使用以下样式,但它不会更改下拉菜单的背景颜色或项目的文本颜色.

I am using Firebase Auth Ui from number verification. I have some requirements where i need to change text and background color of country spinner's dropdown item. I am using this below style but it doesn't change the color of dropdown's background or item's text color.

style name="FirebaseUI.CountrySpinner" parent="Widget.AppCompat.Spinner.Underlined">
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
    <item name="android:dropDownItemStyle">@style/mySpinnerItemStyle</item>
</style>

<style name="mySpinnerItemStyle" parent="@android:style/Widget.Holo.DropDownItem.Spinner">
    <item name="android:textColor">@color/colorVerifyButtonText</item>
</style>

我在这里做错了,请帮帮我.

What am i doing wrong here, please help me out.

推荐答案

您将要扩展FirebaseUI主题并将其传递到构建器选项中. 示例:

You'll want to extend the FirebaseUI theme and pass that into the builder options. Example:

<style name="GreenTheme" parent="FirebaseUI">
    <!-- Required for sign-in flow styling -->
    <item name="colorPrimary">@color/material_green_500</item>
    <item name="colorPrimaryDark">@color/material_green_700</item>
    <item name="colorAccent">@color/material_purple_a700</item>

    <item name="colorControlNormal">@color/material_green_500</item>
    <item name="colorControlActivated">@color/material_lime_a700</item>
    <item name="colorControlHighlight">@color/material_green_a200</item>
    <item name="android:windowBackground">@color/material_green_50</item>
</style>

在Java中:

startActivityForResult(
    AuthUI.getInstance(this).createSignInIntentBuilder()
        // ...
        .setTheme(R.style.GreenTheme)
        .build());

和文档: https://github .com/firebase/FirebaseUI-Android/blob/master/auth/README.md#themes

您基本上将要使用您的下拉属性扩展FirebaseUI样式.

You'll basically want to extend the FirebaseUI style with your drop-down attribute.

这篇关于如何自定义Firebase身份验证UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆