3

中的newChooseAccountIntent()方法AccountPicker允许您通过参数自定义AccountPicker“对话框”(实际上是一个Activity)中的文本descriptionOverrideText

public static Intent newChooseAccountIntent (Account selectedAccount, ArrayList<Account> allowableAccounts, String[] allowableAccountTypes, boolean alwaysPromptForAccount, String descriptionOverrideText, String addAccountAuthTokenType, String[] addAccountRequiredFeatures, Bundle addAccountOptions)

但是“对话框”还带有一个默认设置为“选择帐户”的标题,例如根据本文中包含的屏幕截图

如何自定义此标题,甚至完全删除它?重点不是我想更改措辞,而是我希望能够将措辞翻译成其他语言......对于我的应用程序的用户来说,目前不是很好的用户界面,其他所有内容都使用当地语言,但不是这个“对话”的标题。

4

2 回答 2

2

我知道这个问题被问到已经快 5 年了,但最近我遇到了同样的问题,很难找到帮助。最后,我已经解决了。您不能删除或自定义标题。可以做的是在标题下方添加一个描述作为String descriptionOverrideText,如下所示:

public static Intent newChooseAccountIntent (null, null, new String[]{"com.google"}, false, "HERE ADD SOME TEXT", null, null, null)
于 2020-12-30T16:02:13.537 回答
0

对于 AccountPicker,请使用以下代码更改标题:

AccountPicker.newChooseAccountIntent(
            AccountPicker.AccountChooserOptions.Builder()
                    .setAllowableAccountsTypes(Arrays.asList("com.google"))
                    .setTitleOverrideText("change the title here")
                    .build())
于 2021-05-12T10:08:01.963 回答