AppCompatActivity as a dialog without title

If you are having AppCompatActivity then the following won't work

requestWindowFeature(Window.FEATURE_NO_TITLE);

The simple way is to set it in the style.xml file.

<style name="mytheme" parent="Theme.AppCompat.Light.Dialog">
    <item name="windowNoTitle">true</item>
</style>

It is name="windowNoTitle", not name="android:windowNoTitle"

If you want to remove it programmatically then add the following in onCreate()

getSupportActionBar().hide();

AppCompatActivity is different than Activity and has its own features. For the same purpose, you can simply use -

supportRequestWindowFeature(Window.FEATURE_NO_TITLE);

You can look up the documentation here

Note: Add this before setContentView() to avoid crash.


Set below style in your style.xml

<style name="customDialogTheme" parent="Theme.AppCompat.Light.Dialog">
    <item name="windowNoTitle">true</item>
</style>

then set this theme in your activity

<activity
    android:name=".yourDailogActivity"
    android:configChanges="orientation"
    **android:theme="@style/customDialogTheme"**
    android:screenOrientation="portrait" />