문제

그것은 선택 대화 상자의 테마를 설정할 수 있습니까?

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);

내 기본 앱 테마는 android:Theme.Light 하지만 그 대화는 어둡습니다.고마워

도움이 되었습니까?

해결책

대화 상자의 테마를 변경하려면 newChooseAccountIntent 에게 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);

다른 팁

메서드의 부모 클래스에 정의된 인수를 덮어쓸 때 변경할 수 있습니다 newChooseAccountIntent(Account var0, ArrayList<Account> var1, String[] var2, boolean var3, String var4, String var5, String[] var6, Bundle var7) {}

코드에 추가하여 변경하는 것은 매우 간단합니다...

Intent intent = AccountPicker.newChooseAccountIntent(null, null, new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE}, false, null, null, null, null). putExtra("overrideTheme", 1); startActivityForResult(intent, REQUEST_CODE_EMAIL);

1 은 가벼운 테마를 의미합니다

0 은 어두운 테마를 의미합니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top