安卓:AccountPicker集光主题主题、AccountPicker

2023-09-06 03:44:05 作者:未枯之城

是否可以设置选择对话框的主题?

Is it possible to set the theme of picker dialog ?

import com.google.android.gms.common.AccountPicker;
....
String[] accountTypes = new String[]{"com.google"};
Intent intent = AccountPicker.newChooseAccountIntent(null, null,
                accountTypes, false, null, null, null, null);
activity.startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);

我的基础应用主题是安卓Theme.Light ,但该对话框是黑暗的。 谢谢你。

My base app theme is android:Theme.Light but that dialog is dark. Thanks.

推荐答案

如果你想改变对话的主题,你应该改变 newChooseAccountIntent ZZA 并添加两个整数参数。第一个是用于覆盖主题并将其设置为1将改变对话的主题为光。

If you wish to change the theme of the dialog, you should change the newChooseAccountIntent to zza and add two integer arguments. The first one is for overriding the theme and setting it to 1 will change the dialog theme to light.

String[] accountTypes = new String[]{"com.google"};
Intent intent = AccountPicker.zza(null, null, accountTypes, false, null, null, null, null, false, 1, 0);
startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);