android - builder.setInverseBackgroundForced(true) does not work -
i have in code setinversebackgroundforced set true, doesn't appear work. code produces white text on dark background.
here builder code:
public class test { private void createmylocationdisabledalert() { alertdialog.builder builder = new alertdialog.builder(this); builder.settitle("title") .setinversebackgroundforced(true) .setmessage( "my message") .setcancelable(false) .setpositivebutton("options", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { showoptions(); } }); builder.setnegativebutton("cancel", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { dialog.cancel(); } }); alertdialog alert = builder.create(); alert.show(); } }
what doing wrong? have tried method call in different positions of code block no resolve.
user custom dialog class extending dialogfragment , use show alertdialog.
example:
public class customalertdialog extends dialogfragment { @override public dialog oncreatedialog(bundle savedinstancestate) { alertdialog.builder builder = new alertdialog.builder(this); builder.settitle("title") .setinversebackgroundforced(true) .setmessage("my message") .setcancelable(false) .setpositivebutton( "options", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { showoptions(); } }); builder.setnegativebutton( "cancel", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { dialog.cancel(); } }); alertdialog alert = builder.create(); return alert; } } public class test { private void createmylocationdisabledalert() { new customalertdialog().show(getsupportfragmentmanager(), constants.fragmenttagsearch); } }
note: using support library compatibility, hence use of getsupportfragmentmanager()
.
Comments
Post a Comment