~Onlooker 2010-04-07 08:48 采纳率: 0%
浏览 606
已采纳

如何用现有的自定义主题隐藏 XML 中活动的标题栏

I want to hide the titlebar for some of my activities. The problem is that I applied a style to all my activities, therefore I can't simply set the theme to @android:style/Theme.NoTitleBar.

Using the NoTitleBar theme as a parent for my style would remove the title bar from all of my activities.

Can I set a no title style item somewhere?

转载于:https://stackoverflow.com/questions/2591036/how-to-hide-the-title-bar-for-an-activity-in-xml-with-existing-custom-theme

  • 写回答

30条回答 默认 最新

  • 程序go 2010-04-13 08:15
    关注

    I now did the following.

    I declared a style inheriting everything from my general style and then disabling the titleBar.

    <style name="generalnotitle" parent="general">
        <item name="android:windowNoTitle">true</item>
    </style>
    

    Now I can set this style to every Activity in which I want to hide the title bar overwriting the application wide style and inheriting all the other style informations, therefor no duplication in the style code.

    To apply the style to a particular Activity, open AndroidManifest.xml and add the following attribute to the activity tag;

    <activity
        android:theme="@style/generalnotitle">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(29条)

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改