Theme usage and page timed jump on the Theme of the app interface in Android

Source: Internet
Author: User

Theme is used to set the UI style of an application or an Activity. The following Theme is built in the Android SDK, which can be classified by Title Bar and Status Bar:
Copy codeThe Code is as follows: android: theme = "@ android: style/Theme. Dialog" shows an Activity as a Dialog box.
Android: theme = "@ android: style/Theme. NoTitleBar" does not display the application title bar
Android: theme = "@ android: style/Theme. NoTitleBar. Fullscreen" does not display the application title bar, and is displayed in full screen.
Android: theme = "Theme. Light": white background
Android: theme = "Theme. Light. NoTitleBar" the white background does not have a title bar.
Android: theme = "Theme. Light. NoTitleBar. Fullscreen" white background, no title bar, full screen
Android: theme = "Theme. Black" background Black
Android: theme = "Theme. Black. NoTitleBar" the Black background does not have a title bar.
Android: theme = "Theme. Black. NoTitleBar. Fullscreen" Black background, no title bar, full screen
Android: theme = "Theme. Wallpaper" uses the system desktop as the background of the application
Android: theme = "Theme. Wallpaper. NoTitleBar" uses the system desktop as the background of the application without a title bar.
Android: theme = "Theme. Wallpaper. NoTitleBar. Fullscreen" uses the system desktop as the background of the application. It has no title bar and is full screen.
Android: theme = "Translucent" Translucent
Android: theme = "Theme. Translucent. NoTitleBar" Translucent, no title bar
Android: theme = "Theme. Translucent. NoTitleBar. Fullscreen" Translucent, untitled, full screen
Android: theme = "Theme. Panel"
Android: theme = "Theme. Light. Panel"

Copy codeThe Code is as follows: android: theme = "@ android: style/Theme. Dialog" shows an Activity as a Dialog box.
Android: theme = "@ android: style/Theme. NoTitleBar" does not display the application title bar
Android: theme = "@ android: style/Theme. NoTitleBar. Fullscreen" does not display the application title bar, and is displayed in full screen.
Android: theme = "Theme. Light": white background
Android: theme = "Theme. Light. NoTitleBar" the white background does not have a title bar.
Android: theme = "Theme. Light. NoTitleBar. Fullscreen" white background, no title bar, full screen
Android: theme = "Theme. Black" background Black
Android: theme = "Theme. Black. NoTitleBar" the Black background does not have a title bar.
Android: theme = "Theme. Black. NoTitleBar. Fullscreen" Black background, no title bar, full screen
Android: theme = "Theme. Wallpaper" uses the system desktop as the background of the application
Android: theme = "Theme. Wallpaper. NoTitleBar" uses the system desktop as the background of the application without a title bar.
Android: theme = "Theme. Wallpaper. NoTitleBar. Fullscreen" uses the system desktop as the background of the application. It has no title bar and is full screen.
Android: theme = "Translucent" Translucent
Android: theme = "Theme. Translucent. NoTitleBar" Translucent, no title bar
Android: theme = "Theme. Translucent. NoTitleBar. Fullscreen" Translucent, untitled, full screen
Android: theme = "Theme. Panel"
Android: theme = "Theme. Light. Panel"

These topics can be applied to the entire Application scope or an Activity scope.
Application Scope
Set the theme attribute in the application node of AndroidManifest. xml and apply the theme to the entire application.Copy codeThe Code is as follows: <application
Android: icon = "@ drawable/icon"
Android: icon = "@ string/app_name"
Android: icon = "@ android: style/Theme. Black. NoTitleBar">

Activity scope
Use java code or in AndroidManifest. xml to set the topic of the Activity. The topic is only applied to the current Activity.
The setting method in AndroidMainifest. xml is as follows:Copy codeThe Code is as follows: <activity
Android: name = ". About"
Android: label = "@ string/app_name"
Android: theme = "@ android: style/Theme. Black. NoTitleBar">

You can use java code to set it in onCreate of the current Activity:Copy codeThe Code is as follows: @ Override
Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetTheme (android. R. style. Theme_Translucent_NoTitleBar );
SetContentView (R. layout. main );
}

------------- Jump ---------------------Copy codeThe Code is as follows: 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 ();
}

--------- Push button effect -----------Copy codeThe Code is as follows: imageButton1 = (ImageButton) findViewById (R. id. imageButton3 );
ImageButton1.setOnTouchListener (new OnTouchListener (){
Public boolean onTouch (View v, MotionEvent event ){
If (event. getAction () = MotionEvent. ACTION_DOWN ){
// Change to the background image when the image is pressed
V. setBackgroundResource (R. drawable. menu_btn_f );
} Else if (event. getAction () = MotionEvent. ACTION_UP ){
// The image to be lifted
V. setBackgroundResource (R. drawable. menu_btn );
}
Return false;
}
});

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.