2
在我的應用程序中,我試圖在明暗之間切換主題。但警報對話框文本顏色不隨主題而改變。我爲警報對話框創建了一個主題,但似乎沒有工作。這裏是我的代碼:Android Alert Dialog文字顏色
final AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(mContext, R.style.DialogWhite));
builder.setAdapter(adapter, new OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int which) {
final ActionBarItemResource eab = aList.get(which);
eab.getAction().run();
}
});
// builder.setTitle(tEntityNew.getName());
final AlertDialog alert = builder.create();
alert.show();
我styles.xml
<style name="DialogWhite" parent="@android:style/Theme.Dialog">
<item name="android:textColor">?android:attr/textColorPrimaryInverseDisableOnly</item>
</style>
誰能幫助我?