zoukankan      html  css  js  c++  java
  • android 去掉标题栏 禁止横竖屏 保持全屏

    去掉标题栏:

    <application android:icon="@drawable/icon"  android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">

    或者代码里:

    requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏

    注意这句一定要写在setContentView()方法的前面,不然会报错的。而且这种有时候会看到程序启动后标题栏闪一下消失的情况。

    自定义主题去掉标题栏:在res/values目录下,新建style.xml

    <?xml version="1.0" encoding="UTF-8" ?>
    
    <resources>
    
    <style name="notitle">
    
    <item name="android:windowNoTitle">true</item>
    
    </style>
    
    </resources>

    然后在AndroidManifest.xml文件中定义

    <application
          android:icon="@drawable/icon"
          android:label="@string/app_name"
          android:theme="@style/notitle" >

    三种方法,当然是第一种最简单最省事。

    保持全屏的方法:一共三种:

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            <application
                application=""
                android:icon="@drawable/icon"
                android:label="@string/app_name"
                android:theme="@style/fullscreem" >
  • 相关阅读:
    查询URL字符串参数
    location 对象
    css3 文字特效
    functionDo
    css3 渐变
    [LeetCode][Java]Peeking Iterator
    [LeetCode][JavaScript]Expression Add Operators
    [LeetCode][JavaScript]Different Ways to Add Parentheses
    [LeetCode][JavaScript]Move Zeroes
    [LeetCode][JavaScript]Binary Tree Postorder Traversal
  • 原文地址:https://www.cnblogs.com/miya2012/p/2601125.html
Copyright © 2011-2022 走看看