Note that there are some explanatory texts on larger screens.

plurals
  1. POChange button press color in Dialog Fragment?
    primarykey
    data
    text
    <p>I want to change the color of button press in a dialog like in the image below.</p> <p><img src="https://i.stack.imgur.com/8NKVn.png" alt="enter image description here"></p> <p>I managed to accomplish this when using simple Alert Dialog.</p> <pre><code>AlertDialog.Builder builder = new AlertDialog.Builder(this); // Set dialog title builder.setTitle(Html.fromHtml("&lt;font color='#8b0000'&gt;" + getResources().getString(R.string.delete_this_list) + "?" + "&lt;/font&gt;")); builder.setMessage(getResources().getString(R.string.delete) + " '" + lists[listNo] + "'?\n" + getResources().getString( R.string.delete_this_list_description)) .setCancelable(false) .setPositiveButton(getResources().getString(R.string.delete), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); //Some background stuff //.......// } }) .setNegativeButton( getResources().getString(android.R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); alertDialog = builder.create(); alertDialog.show(); alertDialog.getButton(DialogInterface.BUTTON_POSITIVE) .setBackground(getResources().getDrawable(R.drawable.btn_bar_holo_red)); alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE) .setBackground(getResources().getDrawable(R.drawable.btn_bar_holo_red)); </code></pre> <p>But, this approach does not work when using DialogFragments. When using DialogFragments, there is no getButton method.</p> <p>Any ideas??</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload