在Android Manifest中隐藏对话框的标题栏 [英] Hiding Dialog's titlebar in Android Manifest
问题描述
基本上,我在一个对话框内创建了一个Activity,一切似乎都是完美的,但问题是对话框的标题栏还在。有没有办法隐藏?
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或对话框,这是一个只有成为看起来像一个对话框,粘贴下面的代码。
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.
将此行添加到您的Activity onCreate()方法中。
Add this line to your Activity onCreate() method.
requestWindowFeature(Window.FEATURE_NO_TITLE);
修改:
创建一个扩展Theme.Dialog的自定义样式:
Create a custom style that extend Theme.Dialog:
< resources>
<style name="NoTitleDialog" parent="android:Theme.Dialog">
<item name="android:windowNoTitle">true</item>
</style>`
< / resources>
然后在你的活动中引用这个主题android:theme属性。 :)
Then reference this theme in your activity android:theme attribute. :)
这篇关于在Android Manifest中隐藏对话框的标题栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!