java - Show Light AlertDialog using Theme.Light.NoTitleBar -


i used following line in manifest:

android:theme="@android:style/theme.light.notitlebar" 

to have no title bar , display light version of alertdialog in app, in example: enter image description here

but it's displaying in dark theme still:

enter image description here

my dialog java code:

    new alertdialog.builder(freedraw.this)     .seticon(android.r.drawable.ic_dialog_alert)     .settitle("clear drawing?")     .setmessage("do want clear drawing board?")     .setpositivebutton("yes", new dialoginterface.onclicklistener() {          @override         public void onclick(dialoginterface dialog, int which) {             finish();             startactivity(getintent());           }     })     .setnegativebutton("no", null)     .show(); 

how keep theme light alertdialog?

the top dialog in post holo light themed dialog whereas bottom 1 older themed dialog. cannot holo light themed dialog on versions below honeycomb. here little snippet use select light theme based on android version device running.

the alertdialog.builder use theme of context it's passed. can use contextthemewrapper set this.

contextthemewrapper themedcontext; if ( build.version.sdk_int >= build.version_codes.honeycomb ) {     themedcontext = new contextthemewrapper( freedraw.this, android.r.style.theme_holo_light_dialog_noactionbar ); } else {     themedcontext = new contextthemewrapper( freedraw.this, android.r.style.theme_light_notitlebar ); } alertdialog.builder builder = new alertdialog.builder(themedcontext); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -