How to change the background of Android Alert Dialog Title -
i want change background of alert dialog. have tried following code piece so:
<style name="theme.alertdialog" parent="@android:style/theme.holo.light.dialog"> <item name="android:background">@android:color/transparent</item> <item name="android:textcolor">#659f26</item> <item name="android:windowtitlestyle">@style/theme.alertdialog.title</item> </style> <style name="theme.alertdialog.title" parent="@android:style/textappearance.dialogwindowtitle"> <item name="android:background">@drawable/cab_background_top_example</item> </style>
java code:
contextthemewrapper ctw = new contextthemewrapper( this, r.style.theme_alertdialog); final alertdialog.builder alertdialogbuilder = new alertdialog.builder(ctw); alertdialogbuilder.settitle(getresources().getstring(r.string.confirmation)); alertdialogbuilder.setmessage(getresources().getstring(r.string.msg)); alertdialogbuilder.show();
my app showing dialog this:
while want like:
please suggest, doing wrong.
use code when creating dialog:
dialog.requestwindowfeature(window.feature_no_title);
create own layout many customise done title set layout
dialog.setcontentview(r.layout.yourlayout);
note: use
dialog.requestwindowfeature(window.feature_no_title); before dialog.setcontentview(r.layout.yourlayout);
otherwise give error.
Comments
Post a Comment