-1

In my code dialog2.setTitle("FeedBack"); is shown in a white color. How do I change title change color? Because my layout background is white so I can't see it. How do I change dialog title color?

public Dialog dialog2;
    ImageView b = (ImageView) findViewById(R.id.button1);

    b.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
    dialog2 = new Dialog(context);
    View vLoad = LayoutInflater.from(fifthscreen.this).inflate(R.layout.timer, null);

    dialog2.setContentView(vLoad);
     dialog2.setTitle("FeedBack");
     dialog2.setCancelable(false);
    dialog2.show();
    }
    });

   }


       ////////////timer.xml///////////


              <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="#ffffff"

 android:id="@+id/layouttimer">


      <TextView
    android:id="@+id/text"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="5dp"
    android:paddingRight="5dp"
    android:textSize="15dp"
    android:textColor="#000000" ></TextView>




<Button
    android:id="@+id/FeedbackYummiSlice"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:text=" YumiiSlice" >

</Button>


<Button
    android:id="@+id/FeedbackThisdish"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:text="   Feedback This dish   " >
</Button>

<Button
    android:id="@+id/nothanks"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:text="          No,Thanks          " >

</Button>
</LinearLayout>
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
user2867267
  • 27
  • 3
  • 8

1 Answers1

0

The method setCustomTitle(View customTitleView) allows you to do that. You need to create a layout to set in this, and in that layout simply set to the TextView the style you want.

LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View customTitleView = inflater.inflate(R.layout.custom_title_view, null);

AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setCustomTitle(customTitleView);

Please refer This Answer for more information.

Community
  • 1
  • 1
Hardik Joshi
  • 9,477
  • 12
  • 61
  • 113