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:

enter image description here

while want like:

enter image description here

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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -