I want to customize my title in my DialogFragment, I know how to How to set the title to my DialogFragment , but I want more not just a title , I need a customized title(color,fontSize ...), So I defined a TextView and customized it
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.height_fragment,container,false);
TextView title = new TextView(getContext());
title.setText("Your Height Information");
title.setGravity(Gravity.CENTER);
title.setTextSize(30);
title.setBackgroundColor(Color.GRAY);
title.setTextColor(Color.WHITE);
getDialog().setCustomTitle(title); //Error Can not resolve method setCustomTitle(android.widget.TextView)
return view;
}
but there is an error on this line
getDialog().setCustomTitle(title);
getDialog().setCustomTitle(title);
I searched a lot before posting this question but I couldn't find how can I customize my title of DialogFragment. Thank you for taking time to help me