custom_title.xml
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FF9800" android:padding="16dp">
<TextView android:id="@+id/title" android:text="are you sure" android:textSize="20sp" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="#000" />
</RelativeLayout>
public void downloadSeat(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(WrongSearch.this);
View customTitleView = getLayoutInflater().inflate(R.layout.custom_title, null);
TextView title = (TextView) customTitleView.findViewById(R.id.title);
title.setText("Download Seat Plan");
// builder.setTitle(Html.fromHtml("<font color='#FF7F27'>Download Seat Plan</font>")); builder.setIcon(R.drawable.just);
builder.setCustomTitle(customTitleView);
builder.setMessage(Html.fromHtml("<font color='#2196F3'>Will You Download Seat Plan?</font>"));
builder.setPositiveButton("YES", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
downloadSeat();
}
});
builder.setNegativeButton("NO", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Toast.makeText(getApplicationContext(),"Press YES for download",Toast.LENGTH_LONG).show();
}
});
AlertDialog alert = builder.create();
alert.show();
}