flag_activity_new_task: When the intent object contains this tag, the system will look for or create a new TASK to place the target ACTIVITY.
flag_activity_clear_top: When the intent object contains this tag, if there is an activity instance found on the stack, the activity on top of the instance is emptied, so that it is on the stack.
flag_activity_single_top: When a target ACTIVITY instance exists in a task and is at the top of the stack, no new one is created and the instance is directl
Typically, controls are visible and invisible in three casesThe first type of gone means invisible and does not occupy spaceThe second visible indicates the visibility of theThe third type of invisible means invisible but occupies spacethere are two forms of manifestation that are visible and invisible. In the layout file: [Html]view plaincopyprint?android:visibility="Gone"android:visibility="Visible"android:visibility="Invisible"android:visibility="Gone"android:visibility="Visible"android:visib
1. Set the Transparency (dialog own transparency)Windowmanager.layoutparams Lp=dialog.getwindow (). GetAttributes ();lp.alpha=1.0f;Dialog.getwindow (). SetAttributes (LP);Alpha is between 0.0f and 1.0f. 1.0 completely opaque, 0.0f completely transparent2. Set the Darkness (dialog's own dark degree)Dialog.setcontentview (R.layout.dialog);Windowmanager.layoutparams Lp=dialog.getwindow (). GetAttributes ();lp.dimamount=1.0f;Dialog.getwindow (). SetAttributes (LP);Dialog.getwindow (). Addflags (Wind
Activity fullscreen settings Mode 1: Androidmanifest.xml android:theme= "@android: Style/theme.notitlebar.fullscreen" /> Mode 2: code implementation Requestwindowfeature (Window.feature_no_title); Hide title bar GetWindow (). SetFlags (Windowmanager.layoutparams.flag_fullscreen,windowmanager.layoutparams.flag_fullscreen); Hide the status bar Note: The two-piece code that sets the full screen must precede S
How to set edittext so that only numbers or certain letters can be entered?First, set the EditText, enter only the number:Method 1: Generate the Digitskeylistener object directly.Et_1.setkeylistener (NewDigitskeylistener (false,true));Method 2: Set the property in EditText, android:numeric= "integer" to enter only integers, as followsAndroid:singleline= "true"Android:numeric= "Integer"/>Method 3: Create a new char[] and add the characters that are allowed to be entered. As followsEdittext.set
If you find that the Android device files, that is, the files in the/dev/directory do not have the relevant permissions, you can modify the following files:/system/core/rootdir/ueventd.rcThe contents of the file are as follows:/dev/null 0666 Root root/dev/zero 0666 Root root/dev/full 0666 Root root/DEV/PTMX 0666 Root root/dev/tty 0666 Root root............The individual fields are described below:Driver file path driver file permissions driver file be
); Tv_curmoney is a TextView control}3. Set the Zoom animation/*** /final scaleanimation animation =new scaleanimation (0.0f, 1.0f, 0.0f, 1.0f, Animation.relative_to_self, 0.5f, animation.relative_to_self, 0.5f); Animation.setduration (2000); // Iv_go_rank is a ImageView controlIntroduction to Rates:Defining interpolator in an XML fileAndroid:interpolator= "@android: Anim/accelerate_interpolator"Android:shareinterpolator= "true
//Viewholder the item, holding the position will change with the sliding of the ListView//if ((viewholder.getposition () + 1)% 2 = = 0) {//int color = COLOR.ARGB (255, 101, 181, 109);//Viewholder.getconvertview (). SetBackgroundColor (color);//} else {//int color = COLOR.ARGB (255, 255, 255, 255);//Viewholder.getconvertview (). SetBackgroundColor (color);// } /** The position parameter is not changed with the sliding of the ListView, even if the Viewholder reuse item changes, * The
PreferencescreenAndroid:key= "Button_hmt_setting"Android:title= "@string/hmt_setting_title"android:persistent= "false"> Intentandroid:action= "Android.intent.action.MAIN"Android:targetpackage= "Com.sougou.numberlite"Android:targetclass= "Com.sougou.numberlite.Setting" />Preferencescreen>Android:persistent= "true" property value true to set will not be killed by the systemAndroid:targetpackage the target package name to jump toAndroid:targetclass the target class name to jump toAdd preferen
text is not wrapped automatically.Android:password= "true"Set to enter password onlyAndroid:textcolor = "#ff8c00"Font ColorAndroid:textstyle= "Bold"Font, bold, italic, BolditalicAndroid:textsize= "20dip"SizeAndroid:capitalize = "Characters"Write in uppercase lettersandroid:textalign= "Center"EditText does not have this attribute, but TextView has, centeredandroid:textcolorhighlight= "#cccccc"The background of the selected text, which is blue by defaultAndroid:textcolorhint= "#ffff00"Sets the co
"Set Full Screen"Use the following code before setlayout1 requestwindowfeature (window.feature_no_title); // Hide Title 2 GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,3 WindowManager.LayoutParams.FLAG_FULLSCREEN); // Set Full Screen"Force horizontal screen"Add in Layout1 android:launchmode= "Singletask" android:screenorientation= "Portrait"or rewrite Onresume () in your codeprotected void If(Getrequestedorientation ()!=Super. Onresume ();}The second
Boolean type
Self-writing class
package com.barcode.app;publicclass ExternData{ privatestatictrue; publicstaticgetA() { return a; } publicstaticvoidsetA(Boolean a) { ExternData.a = a; } }
To invoke it
if (ExternData.getA()) { ExternData.setA(false); }String type
Self-writing class
publicclass Data{ privatestatic String a ="15083386523"; publicstaticgetA() {
) {localexception.printstacktrace (); } } /*** Set the current screen brightness value 0--255*/ Private voidSavescreenbrightness (intparamint) { Try{Settings.System.putInt (Getcontentresolver (), Settings.System.SCREEN_BRIGHTNESS, paramint); } Catch(Exception localexception) {localexception.printstacktrace (); } } /*** Save the current screen brightness value and make it effective*/ Private voidSetscreenbrightness (intparamint) {Window Localwindow=GetWindow (); Windowman
Two ways to control font settingsCommon font type names are:
Typeface.default//General font type
Typeface.default_bold//Blackbody font type
Typeface.monospace//equal-width font type
Typeface.sans_serif//sans SERIF Font type
The commonly used font style names are:
Typeface.bold//Bold
Typeface.bold_italic//Coarse italic
Typeface.italic//Italic
Typeface.normal//General1. Set in XML.Use Android:typeface to set:Android:typeface= "Sans"2. In the Java prog
When we study, we feel that it takes time and memory to build a new project, so we often create multiple activities under one project to testBut how do we set the default first-started avtivity to verify that our new experiment is successful?There's a androidmanifest.xml under App.src.main that records what activity you have on your project, and of course it's the default startup item. Let's just put this code in the middle of the activity you want to start by default, just like the code above
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.