麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 系統 > Android > 正文

Android中應用界面主題Theme使用方法和頁面定時跳轉應用

2020-04-11 12:12:21
字體:
來源:轉載
供稿:網友
主題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;
}
});
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 欧美中文字幕一区二区三区亚洲 | 狠狠干视频网站 | 国产毛片在线看 | 亚洲综合视频网站 | 99影视电影电视剧在线播放 | 国产一区二区三区视频观看 | 在线视频观看一区二区 | 日韩黄色免费在线观看 | 精品国产一区二区三区四 | 视频一区二区三区在线播放 | 久久吊 | 国产91影院| 欧美www| 亚洲天堂在线电影 | 精品一区二区在线观看视频 | 精品久久久久久久久久久久包黑料 | 色婷婷一区二区三区 | 成人免费毛片片v | jizzyouxxxx | 999精品久久久 | 日本黄色大片免费观看 | 亚洲码无人客一区二区三区 | 成人免费观看在线视频 | 极品销魂一区二区三区 | 亚洲不卡| 欧美国产一区二区三区 | 久久久久久久久淑女av国产精品 | 成码无人av片在线观看网站 | 中文字幕涩涩久久乱小说 | 午夜视频啊啊啊 | 国产亚洲精品久久久久久网站 | 久久精品中文字幕一区 | 国产女同玩人妖 | 久久精品站 | 香蕉视频18 | 激情综合网俺也去 | 成av在线| 国产免费乱淫av | 高潮激情aaaaa免费看 | 免费看毛片的网站 | 午夜精品老牛av一区二区三区 |