Android Activity 设置全屏
来源:互联网 发布:识汝不识丁网络剧免费 编辑:程序博客网 时间:2024/09/21 09:24
Android Activity 设置全屏的方法如下:
1.代码设置:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //去除标题栏 requestWindowFeature(Window.FEATURE_NO_TITLE); //去除状态栏 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main);//要放到加载布局文件代码之前 initView(); initData(); initListener(); }
2.清单文件中设置:
<activity android:name=".PlayerActivity" android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>在清单文件中注册Activity时,使用 Theme.NoTitleBar.FullScreen 这一主题。
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
3.定义style样式:
<style name="full_screen_style"> <item name="android:windowNoTitle">true</item> <item name="android:windowFullscreen">true</item> </style>在res/values/styles文件中定义一个全屏的style样式
下面使用该样式:
<activity android:name=".PlayerActivity" android:screenOrientation="landscape" android:theme="@style/full_screen_style"/>清单文件中注册该activity时在theme属性中使用该样式即可
4.创建theme.xml文件:
其实它和 3定义style样式是相同的,只不过把style样式定义在了theme.xml文件中而已。
在res/values文件夹下创建theme.xml文件,在theme.xml文件中定义一个style主题样式
<?xml version="1.0" encoding="utf-8"?><resources> <style name="full_screen_theme"> <item name="android:windowFullscreen">true</item> <item name="android:windowNoTitle">true</item> </style></resources>使用该样式:
<activity android:name=".PlayerActivity" android:screenOrientation="landscape" android:theme="@style/full_screen_theme"/>
6 0
- Android Activity设置全屏
- 【Android】Activity全屏设置
- Android Activity设置全屏
- Android Activity 设置全屏
- Android activity设置全屏
- android设置activity全屏 | 无标题
- android 设置activity不全屏
- android设置activity全屏 | 无标题
- android设置activity全屏 | 无标题
- Android如何设置Activity全屏
- android设置activity全屏 | 无标题
- android设置activity全屏 | 无标题
- Android设置Activity全屏和无标题
- Android 设置Activity大小不再全屏原理
- Android设置Activity全屏和无标题
- Android 设置Activity 全屏的方法
- Android Activity全屏和设置背景色
- android studio IDE 下,设置ACTIVITY全屏
- PHP:The FastCGI process exited unexpectedly
- JAVA获取当前时间戳
- eclipse自动添加作者、日期等注释
- Xilinx FPGA 学习笔记——原语 BUFIO 的理解
- LEETCODE--Path Sum III
- Android Activity 设置全屏
- 关于Springmvc+Spring4整合json的一些问题
- 汇编 loop 循环 案例一
- Python爬虫伪装
- ZYNQ 的三种GPIO :MIO EMIO AXI_GPIO 小节
- 图的深度遍历
- android——学习笔记
- 浅入浅出 Android 安全 (四) Android 框架层安全
- redis集群搭建