隐藏对话框的标题栏的Andr​​oid清单对话框、清单、标题栏、Andr

2023-09-12 05:20:03 作者:二乔.

基本上,我创建了一个对话框内的活动,全部的寄托似乎是工作完美,但问题是一个对话框的标题栏仍然存在。反正是有隐藏呢?

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.

请注意:这不仅仅是一个ALERTDIALOG或对话,这是一个活动内部的对话,其中不仅成为看起来像一个对话框,粘贴下面的code

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>

推荐答案

您可以通过编程删除标题栏。

You can remove the title bar programatically.

将此行添加到您的活动的onCreate()方法。

Add this line to your Activity onCreate() method.

requestWindowFeature(Window.FEATURE_NO_TITLE);

编辑:

创建一个自定义样式,扩展Theme.Dialog:

Create a custom style that extend Theme.Dialog:

&LT;资源&GT;

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

&LT; /资源&GT;

然后引用这个主题在你的活动的android:theme属性。 :)

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