Android - 努力设置帐户选择器的样式

标签 android accountmanager accountpicker

我正在尝试在我的游戏中实现一个 AccountPicker,我已经尝试使用 newChooseAccountIntent 的所有三个版本,2 个来自 AccountManager,一个来自 帐户选择器

我的代码是这样的

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
    intent = AccountManager.newChooseAccountIntent(null, null, new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE}, null, null, null, null);
} else {
    intent = AccountManager.newChooseAccountIntent(null, null, new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE}, false, null, null, null, null);
}

或相同,但将 AccountManager 替换为 AccountPicker

我的目标是有一个看起来像这样的选择器

ideal picker

但是使用 AccountManager 我得到

AccountManager

至少是 Material 的颜色

或者来自 AccountPicker (ICS!!)

enter image description here

知道我做错了什么吗?

我认为可能是 AccountManager 正在填充第一个字段,即 selectedAccount,但当我这样做时,它只是选择了相应帐户的单选按钮。

最佳答案

您可以使用 Google Api 客户端 document

关于Android - 努力设置帐户选择器的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42799247/

相关文章:

android - 我如何将当前日期与日期选择器中的用户输入日期进行比较

android - 我可以完全在服务器端验证 Google Play 应用内订阅续订吗?

android - 使用 AccountPicker.newChooseAccountIntent 选择电子邮件

android - 防止对话框在 EditTextPreference onClick 中显示

android - 方向从横向变为纵向后,RecyclerView 位于中间而不是顶部

java - 同时启动两个进程

android - Accountmanager.addAccount() 与 Accountmanager.addAccountExplicitly()

android - 如果没有帐户,AccountPicker.newChooseAccountIntent 不显示选择器

android - Android 账户管理器是否加密存储在其中的信息?

android - 从 AccountManager 获取基本的谷歌授权 token