zoukankan      html  css  js  c++  java
  • android 去除标题栏

    1.如果你的activity继承自Activity,那么

          a.要在style.xml中写入:

    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="windowNoTitle">true</item>
    </style>

      b.在AndroidManifest.xml中的application标签里写入:

    android:theme="@style/AppTheme"

    2.如果你的activity继承自AppCompatActivity,那么

         a.要在style.xml中写入:

    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="windowNoTitle">true</item>

       <item name="windowActionBar">false</item>
    </style>

         b.在AndroidManifest.xml中的application标签里写入:

    android:theme="@style/AppTheme"

    注意:以上两种方式会把所有的页面设置成无标题栏状态。

    3.如果你不想设置所有页面都无标题栏,只是个别页面无标题栏

    比如:只有MainActivity对应的页面没有标题栏,其他还是默认状态,那么

        a.要在style.xml中加上:

    <style name="AppTwoTheme" parent="Theme.AppCompat.Light.DarkActionBar">
      <item name="windowNoTitle">true</item>
      <item name="windowActionBar">false</item>
    </style>

      b.在AndroidManifest.xml中的activity标签里写入:

    <activity android:name=".MainActivity" android:theme="@style/AppTwoTheme">
      <intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>

    
    
  • 相关阅读:
    Adobe Flex初记
    将获得datebox值的文本形式转为日期格式
    Java代码中获取Json的key值
    SortedMap与TreeMap的一个典型应用
    上传本地代码到github&&从github下载源码
    springMVC第一课--配置文件
    MySQL视图的优缺点以及如何创建视图
    一张图看懂IaaS, PaaS和SaaS的区别
    二十三种设计模式-六大原则
    数据库设计三大范式
  • 原文地址:https://www.cnblogs.com/Sailsail/p/6407541.html
Copyright © 2011-2022 走看看