我正在显示 AccountPicker 对话框Google Play Services
用这个代码:
String[] accountTypes = new String[]{"com.google"};
Intent intent = AccountPicker.newChooseAccountIntent(null, null,
accountTypes, false, null, null, null, null);
startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);
即使我使用 AppCompat v21 ,它仍显示为深色主题对话框Theme.AppCompat.Light
.
是否有可能对话框样式?最好作为Material dialog on Lollipop
但至少让它成为一个与我的应用程序相匹配的轻型对话框。
我认为,没有必要“破解”。可以更容易地实现:
...
String[] accountTypes = new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE};
Intent intent = AccountPicker.newChooseAccountIntent(null, null, accountTypes, false, description, null, null, null);
// set the style
if ( isItDarkTheme ) {
intent.putExtra("overrideTheme", 0);
} else {
intent.putExtra("overrideTheme", 1);
}
intent.putExtra("overrideCustomTheme", 0);
try {
startActivityForResult(intent, YOUR_REQUEST_CODE_PICK_ACCOUNT);
} catch (ActivityNotFoundException e) {
...
}
...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)