2

Basically, I created an Activity inside a dialog, everthing is seems working perfectly but the problem is the title bar of a dialog is still there. Is there anyway to hide it?

And also this is the tutorial, here is the link. It is exactly what I am trying to accomplish except witout title bar.

Note: THIS IS NOT JUST AN ALERTDIALOG OR DIALOG, THIS IS AN ACTIVITY INSIDE A DIALOG which only became looks like a dialog by pasting the code below.

<activity android:label="My Dialog (activity)" android:name=".MyActivity" android:theme="@android:style/Theme.Dialog"></activity>

enter image description here

Leon
  • 339
  • 1
  • 7
  • 23

4 Answers4

10

If ur using appcompat support v4, v7 libraries then try using

supportRequestWindowFeature(Window.FEATURE_NO_TITLE);

before setContentView and also before super.Oncreate();

Gopal Singh Sirvi
  • 4,539
  • 5
  • 33
  • 55
Amit Tumkur
  • 2,752
  • 26
  • 27
9

You can remove the title bar programatically.

Add this line to your Activity onCreate() method.

requestWindowFeature(Window.FEATURE_NO_TITLE);

Edit:

Create a custom style that extend Theme.Dialog:

<resources>

<style name="NoTitleDialog" parent="android:Theme.Dialog">
    <item name="android:windowNoTitle">true</item>
</style>`

</resources>

Then reference this theme in your activity android:theme attribute. :)

M.ES
  • 920
  • 14
  • 30
0

I came up with such, easiest solution: In Manifest android:theme="@android:style/Theme.Holo.Light.Dialog.NoActionBar"> Seems to work.

Pawel
  • 57
  • 11
0

Try this :

style.xml

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

AndroidManifest.xml

   <activity
        android:name=".DialogActivity"
        android:theme="@style/NoTitleActivityDialog"/>
Kapil Rajput
  • 11,429
  • 9
  • 50
  • 65