Android中应用界面主题Theme使用方法和页面定时跳转应用
发布时间:2023-08-30 17:05:59
标签:主题,Theme,定时跳转
主题Theme就是用来设置界面UI风格,可以设置整个应用或者某个活动Activity的界面风格。在Android SDK中内置了下面的Theme,可以按标题栏Title Bar和状态栏Status Bar是否可见来分类:
android:theme="@android:style/Theme.Dialog" 将一个Activity显示为能话框模式
android:theme="@android:style/Theme.NoTitleBar" 不显示应用程序标题栏
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 不显示应用程序标题栏,并全屏
android:theme="Theme.Light" 背景为白色
android:theme="Theme.Light.NoTitleBar" 白色背景并无标题栏
android:theme="Theme.Light.NoTitleBar.Fullscreen" 白色背景,无标题栏,全屏
android:theme="Theme.Black" 背景黑色
android:theme="Theme.Black.NoTitleBar" 黑色背景并无标题栏
android:theme="Theme.Black.NoTitleBar.Fullscreen" 黑色背景,无标题栏,全屏
android:theme="Theme.Wallpaper" 用系统桌面为应用程序背景
android:theme="Theme.Wallpaper.NoTitleBar" 用系统桌面为应用程序背景,且无标题栏
android:theme="Theme.Wallpaper.NoTitleBar.Fullscreen" 用系统桌面为应用程序背景,无标题栏,全屏
android:theme="Translucent" 半透明
android:theme="Theme.Translucent.NoTitleBar" 半透明、无标题栏
android:theme="Theme.Translucent.NoTitleBar.Fullscreen" 半透明、无标题栏、全屏
android:theme="Theme.Panel"
android:theme="Theme.Light.Panel"
android:theme="@android:style/Theme.Dialog" 将一个Activity显示为能话框模式
android:theme="@android:style/Theme.NoTitleBar" 不显示应用程序标题栏
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 不显示应用程序标题栏,并全屏
android:theme="Theme.Light" 背景为白色
android:theme="Theme.Light.NoTitleBar" 白色背景并无标题栏
android:theme="Theme.Light.NoTitleBar.Fullscreen" 白色背景,无标题栏,全屏
android:theme="Theme.Black" 背景黑色
android:theme="Theme.Black.NoTitleBar" 黑色背景并无标题栏
android:theme="Theme.Black.NoTitleBar.Fullscreen" 黑色背景,无标题栏,全屏
android:theme="Theme.Wallpaper" 用系统桌面为应用程序背景
android:theme="Theme.Wallpaper.NoTitleBar" 用系统桌面为应用程序背景,且无标题栏
android:theme="Theme.Wallpaper.NoTitleBar.Fullscreen" 用系统桌面为应用程序背景,无标题栏,全屏
android:theme="Translucent" 半透明
android:theme="Theme.Translucent.NoTitleBar" 半透明、无标题栏
android:theme="Theme.Translucent.NoTitleBar.Fullscreen" 半透明、无标题栏、全屏
android:theme="Theme.Panel"
android:theme="Theme.Light.Panel"
这些主题可以应用到整个应用Application范围或者某个活动Activity范围中。
应用Application范围
在AndroidManifest.xml中的application节点中设置theme属性,主题theme应用到整个应用程序中。
<application
Android:icon=”@drawable/icon”
Android:icon=”@string/app_name”
Android:icon=”@android:style/ Theme.Black.NoTitleBar”>
活动Activity范围
使用java代码或者在AndroidManifest.xml中对活动Activity的主题进行设置,主题仅应用到当前活动中。
在AndroidMainifest.xml设置方法:
<activity
android:name=“.About”
android:label=“@string/app_name”
android:theme=“@android:style/ Theme.Black.NoTitleBar” >
使用java代码进行设置,在当前活动Activity的onCreate中进行设置:
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setTheme(android.R.style.Theme_Translucent_NoTitleBar);
setContentView(R.layout.main);
}
-------------跳转---------------------
public void Start() {
new Thread() {
public void run() {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Intent intent = new Intent();
intent.setClass(WelComeActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
}.start();
}
---------为按钮添按下效果-----------
imageButton1 = (ImageButton) findViewById(R.id.imageButton3);
imageButton1.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
// 更改为按下时的背景图片
v.setBackgroundResource(R.drawable.menu_btn_f);
} else if (event.getAction() == MotionEvent.ACTION_UP) {
// 改为抬起时的图片
v.setBackgroundResource(R.drawable.menu_btn);
}
return false;
}
});


猜你喜欢
- Android 图片选择可以达到的效果:1.第一个图片的位置放照相机,点击打开照相机2.其余的是显示全部存储的图片,点击一次是查
- 参考资料《Java 编程思想》,关于含有基类的导出类,其成员的初始化过程是一个容易让人困惑的地方,下面通过具体的实例进行讲解,代码取自《Ja
- 一、Android 个人手机通讯录开发数据存储:SQLite 数据库开发工具:Android Studio二、Phone Module 简介
- 记事本涉及到的仅仅是对string 的存储,而且在读取上并不存在什么难点,直接用textview显示便可以了。需要做的主要是使用SQLite
- spring-boot-devtools是一个为开发者服务的一个模块,其中最重要的功能就是自动应用代码更改到最新的App上面去。原理是在发现
- 一、题目描述题目:有五个学生,每个学生有 3 门课的成绩,从键盘输入以上数据(包括学生号,姓名,三门课成绩),把这些数据存放在磁盘文件 &q
- 背景数据库在保存数据时,对于某些敏感数据需要脱敏或者加密处理,如果一个一个的去加显然工作量大而且容易出错,这个时候可以考虑使用 * ,本文针
- C#Windows server2016服务器搭建NFS共享文件夹与C#上传图片到共享文件夹nfs共享文件夹实现步骤基于:Windows s
- 如下所示:public static String reThreeStr(String ss){boolean result= ss.mat
- 本文实例展示了DevExpress根据条件设置GridControl RepositoryItem是否可编辑的方法。一般在C#项目的开发中,
- using System;using System.Collections;using System.Xml;namespace Jb51.
- yml配置规则属性跟属性值之间使用“:”和一个“空格”隔开,
- 最近项目用到了Spring Boot ,但是在控制器返回html视图并渲染参数的时候,存在了疑问。后面考虑用Thymeleaf ,感觉真的不
- 使用POI读写Word doc文件 Apache poi的hwpf模
- 今天研究了一下scope的作用域。默认是单例模式,即scope="singleton"。另外scope还有prototy
- 本文实例讲述了android从资源文件中读取文件流并显示的方法。分享给大家供大家参考。具体如下:在android中,假如有的文本文件,比如T
- 一、APP端调用1、注册广播监听查找结果//蓝牙发现设备和查找结束广播IntentFilter intentFilter = new Int
- java addMouseListener()方法使用用于接收组件上“感兴趣”的鼠标事件(按下、释放、单击、进入或离开)的 * 接口。(要跟
- 目前较常用的分页实现办法有两种:1.每次翻页都修改SQL,向SQL传入相关参数去数据库实时查出该页的数据并显示。2.查出数据库某张表的全部数
- 举例说明自定义C++异常处理的实例例1:自定义一个继承自excepton的异常类myExceptionC++标准中,定义在<stdex