При нажатии на кнопку изображения всплывает всплывающее уведомление. Как настроить кнопки «ОК» и «Отмена», чтобы вместо использования внешнего вида кнопок по умолчанию я хотел использовать свои собственные настраиваемые кнопки ImageButton в качестве «ОК» и «Отмена».
Вот мой код для всплывающего уведомления.
public class Notifications extends AppCompatActivity {
ImageButton Notifications;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notifications);
Notifications = (ImageButton) findViewById(R.id.AllowNotifications);
Notifications.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(Notifications.this);
builder.setCancelable(false); //False= ONLY way to exist notification is by clicking NO
//True= Exit notification by clicking anywhere on screen outside of notification box.
builder.setTitle("Here is the alert dialog");
builder.setMessage("Here is my message thing");
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int WhichButton) {
dialog.cancel();
}
});
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
});
builder.show();
}
});
}
}
Вот всплывающее уведомление по умолчанию с приведенным выше кодом:
Поэтому вместо красного цвета «ОК» и «Отмена» я хочу поместить «ОК» и «Отмена» в качестве своих собственных кнопок с изображением, и я бы хотел изменить цвет с красного на что-то другое. Как мне сделать это во всплывающем уведомлении?