Android:AccountPicker设置Light Theme

Mic*_*Tin 8 android android-theme google-authenticator android-authenticator google-play-services

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

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);
Run Code Online (Sandbox Code Playgroud)

我的基本应用主题是android:Theme.Light但对话框很暗.谢谢.

nei*_*its 9

如果要更改对话框的主题,则应更改newChooseAccountIntentto zza并添加两个整数参数.第一个用于覆盖主题并将其设置为1将对话框主题更改为浅.

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);
Run Code Online (Sandbox Code Playgroud)

  • 仅供参考,看起来这是一个内部/私有API ...所以使用它可能在未来打破. (4认同)