Change background color of the title of a Dialog

0

I have the following dialog box:

ThegreenpartwassetwithLinearLayout,buttheandroid:background="#77FF77" attribute did not change the color of the title bar.

Dialog Java:

public void ver_log(View v){
   DialogLog();
}

private void DialogLog(){
    final Dialog dialogLog = new Dialog(this);
    dialogLog.setContentView(R.layout.dialog_log);

    dialogLog.setTitle("CÁLCULOS");

    final Button btnFechar = (Button) dialogLog.findViewById(R.id.btn_fechar);
    final Button btnCopiar = (Button) dialogLog.findViewById(R.id.btn_copiar);

    btnFechar.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialogLog.dismiss();
        }
    });

    btnCopiar.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            //Ação de copiar
        }
    });

    dialogLog.show();
}

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"
    android:orientation="vertical"
    style="@style/Dialogs" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="10dp">

    <TextView
        android:id="@+id/relatorio"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="20sp"
        android:text="" />

    </LinearLayout>

    <LinearLayout 
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
        <Button
            style="@style/BotoesDialogs"
            android:id="@+id/btn_fechar"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="@string/fechar" />
        <Button
            style="@style/BotoesDialogs"
            android:id="@+id/btn_copiar"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="@string/copiar" />
    </LinearLayout>

</LinearLayout>

How can I change this part? Is it possible to also change the color of the title "CALCULATIONS" and this blue bar underneath?

    
asked by anonymous 26.12.2014 / 01:15

1 answer

1

You have two ways:

Or override the% s style of every app in your theme.

Or remove the title, using Dialog in Dialog.requestWindowFeature(Window.FEATURE_NO_TITLE) , before anything else . And create a custom title for onCreate , within the content layout of your Dialog

    
26.12.2014 / 12:50