android - Customize alert dialog -


I have a piece, which automatically displays a dialog I want to change the color and button color of the title of the dialog (When pressed) Is there any way I can do that?

  Expands MyFragment fragment of public category {Public View Creatives (LayoutEfter Inflator, View Group Container, Bundle Saved InstantState) {// ... AlertDiLog Advertising = New AlertDialog Settlement ("title"). Setmessage ("Message"). Set Positive Button ("Yes", New Dialog Interface. OnClicklist (Click on Public Zero (Dialogue Interface Dialog, Int Jabunton) {// Yes Logic}) .setNegativeButton ("No", New DialogInterface.OnClickListener () {// No Logic}}). Create (); Ad.show (); Inflater.inflate (R. Late fragment_m, container); Return super.Contetiview (Inflator, Container, Saved Instantstate); }  

You can create your own dialog class Which expands the Android dialog , then you can customize it background background, customize its title and so on.

  Public class MyDialogs dialog {public MyDialog (context context) {// Adding it to your custom theme super (context, R. style.mydialog_theme); } @ Override Protected Zero (Bundle Saved InstantState) {// delete your original title bar request; WindowsFeature (window.FEATURE_NO_TITLE); // Getting the reference of your window object window = getWindow; // On the screen where your dialogue window opens. Setgravity (Gravity CA); // Set your content view setTentview (R. layout.Medical_Layout); }}  

As a result you can create such a dialogue:
Enter image details here


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -