I've trying to create DialoFragment with AppCompat theme, but when i use AppCompat theme, dialog title is not shown.
I'am using defined style:
<style name="DialogFragment" parent="Theme.AppCompat.Light.Dialog"/>
When parent theme will be changed to:
<style name="DialogFragment" parent="android:Theme.Material.Light.Dialog"/>
or
<style name="DialogFragment" parent="android:Theme.Holo.Light.Dialog"/>
title is displaying properly.
Code of my dialog:
public class InfoDialog extends DialogFragment {
public static final String TAG = InfoDialog.class.getName();
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.getWindow().setTitle(getString(R.string.dialog_title));
return dialog;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NORMAL, R.style.DialogFragment);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.info_dialog, container, false);
}
}
Any ideas what is causing the issue?
Application use com.android.support:appcompat-v7:22.2.0
, maybe this is platform bug?
Try extending AppCompatDialogFragment instead of DialogFragment. That should do the trick.