AccountPicker的自定义标题

时间:2016-01-11 14:53:50

标签: android google-play-services accountpicker

AccountPicker中的newChooseAccountIntent()方法可让您自定义AccountPicker"对话框中的文字" (实际上是Activity)通过descriptionOverrideText参数:

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

但&#34;对话框&#34;还附带一个标题,默认设置为&#34;选择一个帐户&#34;,例如根据this post中包含的屏幕截图。

如何自定义此标题,甚至完全删除它?问题不在于我想要改变措辞,而是我希望能够将措辞翻译成其他语言......对于我的应用程序用户而言,其他所有其他语言都不是很好的用户界面,但不是这个&#34;对话框的标题&#34;。

2 个答案:

答案 0 :(得分:2)

我知道自从提出这个问题已经快 5 年了,但最近我遇到了同样的问题,很难找到帮助。最后,我已经解决了。您无法删除或自定义标题。可以做的就是在标题下面添加一个描述为String descriptionOverrideText,像这样:

public static Intent newChooseAccountIntent (null, null, new String[]{"com.google"}, false, "HERE ADD SOME TEXT", null, null, null)

答案 1 :(得分:0)

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

AccountPicker.newChooseAccountIntent(
            AccountPicker.AccountChooserOptions.Builder()
                    .setAllowableAccountsTypes(Arrays.asList("com.google"))
                    .setTitleOverrideText("change the title here")
                    .build())