You can try the below code for AlertDialog with Yellow color.
In Java:
View view = LayoutInflater.from(this).inflate(R.layout.dialog, null);
View customTitleView = LayoutInflater.from(this).inflate(R.layout.title, null);
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AlertDialogCustom);
builder.setView(view);
builder.setCustomTitle(customTitleView);
builder.setNegativeButton("Close", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
In style.xml:
<style name="AlertDialogCustom" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:colorBackground">@color/yellow</item>
<item name="android:windowBackground">@color/yellow</item>
</style>
In colors.xml:
<color name="yellow">#FFFF00</color>
Create below layout XML:
title.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Dialog"
android:textColor="@android:color/black"
android:textSize="20sp" />
</LinearLayout>
dialog.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
Create a custom view with textview, edittext or whatever you want.
</LinearLayout>
Your output will be like below image:

I hope this is what you want to achieve, if you have any queries please let me know.