我目前使用AlertDialog
來提示用戶並要求評分。它的工作原理與使用AS仿真器(Nexus 5 API 23)相同。AlertDialog按鈕文本格式在某些設備上完全錯誤
從模擬器:
但是,我測試的對話框了我朋友的設備上,LG的柱花草(安卓5.1.1,空氣污染指數22)和格式是完全錯誤的。按鈕順序錯誤,根本沒有正確格式化。
從LG柱花草:
我不知道如何去確保該格式是一個AlertDialog
正確的,我真的不知道爲什麼格式不上LG正確Stylo,不幸的是我目前沒有其他設備來測試它。
在此先感謝!
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setMessage(R.string.rateMeText)
.setPositiveButton(R.string.rateMe, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(Intent.ACTION_VIEW);
editor.putBoolean(KEY_REMIND_ME_LATER, false);
editor.commit();
try {
intent.setData(Uri.parse(myContext.getString(R.string.playStoreMarketLink) + APP_PNAME));
myContext.startActivity(intent);
}catch (Exception e){
intent.setData(Uri.parse(myContext.getString(R.string.playStoreHttpLink) + APP_PNAME));
myContext.startActivity(intent);
}
dialog.dismiss();
}
})
.setNegativeButton(R.string.noThanksAndDoNotAskAgain, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (editor != null) {
editor.putBoolean(KEY_REMIND_ME_LATER, false);
editor.commit();
/*editor.putBoolean(KEY_DONT_SHOW_AGAIN, true);*/
editor.commit();
}
dialog.dismiss();
}
})
.setNeutralButton(R.string.remindMeLater, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
editor.putLong(KEY_LAUNCH_COUNT_PRESSED_REMIND, launches);
editor.putBoolean(KEY_REMIND_ME_LATER, true);
editor.commit();
System.out.print(sharedPrefs.getLong(KEY_LAUNCH_COUNT_PRESSED_REMIND, 27727));
dialog.dismiss();
}
});
builder.create().show();
您是否使用API 22(即5.1.1)在仿真器上測試了它? –
您是使用'android.app.AlertDialog'還是'android.support.v7.app.AlertDialog'? –
如果不設置樣式,即使設置應用程序主題,設備有時也會使用其自己的默認樣式。如果你不設置風格,它就是一種垃圾拍攝。 –