:
Myproject/
Res/
Values/
Strings. xml
Values-ES/
Strings. xml
Values-fr/
Strings. xml
Add the string values of each language to the corresponding file.
At runtime, the android system uses the corresponding string resources based on the current language settings of the User device.
For example, the following is a string resource file in different languages.
English (default language encoding),/values/string
There are a lot of nice examples in the Android API demos, and the code for these examples is pretty good, so if you're working through every single example in the API demos, congratulations on being a real Android player. It's also a way for some of the more confused Android developers to point out an ability to improve themselves. There are many examples in API
/********************************************************************* * Different stages of Android Logo display * Description: * U-boot Stage has the Logo,kernel stage has the logo, the file system init stage has the logo, * enters the android to have the dynamic logo. * 2016-9-8 Shenzhen Nanshan Ping Shan village Zengjianfeng **********************************
Sometimes, to display different images in the same ImageView, we often use:View plaincopy to clipboardprint?If (condition 1 ){Image. setBackground (R. id. xxx1 );} Else if (condition 2 ){Image. setBackground (R. id. xxx2 );}If (condition 1 ){Image. setBackground (R. id. xxx1 );} Else if (condition 2 ){Image. setBackground (R. id. xxx2 );} You can use another simple method to implement the same function. First, create an xml file under res/drawable wit
Diffbundle = new bundle ();//if (!newitem.header.equals (Olditem.header)) {//Diffbundle.putstring (Key_heeder, newitem.header);// }//if (!newitem.footer.equals (Olditem.footer)) {//Diffbundle.putstring (Key_footer, newitem.footer);// }//if (diffbundle.size () = = 0) return NULL;//return diffbundle;}This we write a bean, inside we put the header and footer, and then make a comparison, this way I will not write the demo. Believe in this writing you should be able to read.
/ awesomeimage.png drawable-hdpi/ awesomeimage.png drawable-mdpi/ awesomeimage.png drawable-ldpi/ awesomeimage.pngNext, when referencing @drawable/awesomeimage at any time, the system selects the appropriate bitmap image based on the DPI of the screen.Finally, put the boot icon into the mipmap/folder:res/... mipmap-ldpi/... finished_launcher_asset.png mipmap-mdpi/... finished_launcher_asset.png mipmap-hdpi/... finished_launcher_a
very good, But when I put the program on my Android 4.4 (Galaxy S5 It seems that the problem of this model is very many ... ) When the Flash comes back! The case is that when I click on a button to create an instance of fragment, the program runs normally, but when I click on the interface button that has already created the instance again, it will go away, I don't know what is going on, and the API has not found the relevant instructions.For a long
events);"False" indicates an unavailable state to use. android:window_focusedBoolean. "True" indicates that the application window has the focus when used (applicationin the foreground); "false" means use when there is no focus (for example, the notification bar pullsOr the dialog box appears).Note: Remember that the first item in StateList that matches the current state will be used. Therefore, if the first item is notIf there is any state attribute, then it will be used every time, which is w
Use the following code in Android to sharedpreferences data sharing between two applications, but only if you want to ensure that the android:shareduserid of the two applications is the sameContext context = NULL; try {context=createpackagecontext ("com.android.providers.downloads", context.context_ignore_security);} catch ( Namenotfoundexception e) {//TODO auto-generated catch Blocke.printstacktrace ();} Sharedpreferences mprefs = context.getsharedpr
As the Android version continues to update, the new API is constantly gushing, and sometimes the high-version API is crash in the lower version.If the minsdkversion setting is too low, the error will be in the build (call requires API level 9);In order to compile can pass, can add @SuppressLint("NewApi") or@TargeApi(9)注解。This is only compiled through, the runtime will still be crash.The right approachIn order to run without error, you need:
Dete
There is a requirement in the Android project to draw a few linearlayout layouts into the ListView style, as shown in:When you click each linearlayout item to change its background color, the following background image XML file is prepared:XML version= "1.0" encoding= "Utf-8"?>selectorxmlns:android= "Http://schemas.android.com/apk/res/android"> Itemandroid:drawable= "@color/gray_background"android:state_
stored in the resources directory because it cannot be written on the ipad.So what should you do with the read and write XML on the ipad? The method is described as follows:Store the files that need to be serialized in the Application.persistentdatapath directory, which is a platform-dependent path.Write:XmlDocument xmldoc = new XmlDocument ();...Xmldoc.save (application.persistentdatapath+ "//abc.xml");Read:XmlDocument xmldoc = new XmlDocument ();Xmldoc.load (application.persistentdatapath+ "/
Recently in the circle of friends "looking for the name of the house" and "miles seek knife" such small games than the fire. I tried to write a version of Android, which is full of a series of shape near the word, the implementation of the principle is very easy: with a GridView and then every item into a square can be, click on the correct item to change the number of rows and columns of the GridView can be.First, the game description:Find the differ
In real-world applications, you need to display a string with a different color and font. Of course, it can be stitched together by different textview. Can also be shown through a textview.The steps are as follows:1. Define different style.You might want to define 2 style as follows 2. Format the string with spannablestring. The code is as follows:Mtextv
Implementation Code
Adapter code
Viewholder has three different la s, that is, the layout of each item in listview.
Type_1... is three types.
When different la s are used, getitemviewtype and getviewtype should not be small. Generally, they do not need to be overloaded by these two functions.
Class runrankadapter extends baseadapter {arraylist
Usage:
Declare and define your own adapter, and set its adapt
Set text of different styles in the same TextView of Android
Requirement Analysis:
Most of the time, we need to display text of different styles in the view, but in order to reduce the viewgroup level, we do not want to add many TextView controls to implement text of different styles.
Is there a way to implement multip
a previous project requires an effect: For a listactivity, the menus popped up by different items are different. As shown in, we need to bring up menus with different titles by pressing different items: For A Long press event, you can use the setonitemlongclick function of listview to associate the event. However, the
Android uses two attributes to classify the screen of a device: size and density. You should imagine the device screen size and density range for installing your app. For example, you should include some optional resources to optimize the display appearance of your applications on screens of different sizes and density. 1. four general dimensions: small, normal, large, xlarge 2. four General density types:
the Eclipse Project's package directory. The interface for the AIDL service is defined in the Aidl file. That is, interface-oriented programming, as above contains Getrandomint () empty method.2) Set up a service class (subclass of Services). Implements the Getrandomint () generated by the Aidl file.3) Configure the Aidl service in the Androidmanifest.xml file. That is declared under the Intent-filter tag in the service.4) Open a background thread in APPB activity, thread range create serviceco
============ Problem Description ============Take a look at the pictureHowever, on the Xiaomi or Huawei phone, the date control shows 201 April-September-03, the month column more than a "month" word, this feeling very uncomfortable:Ask: The above question, is the handset compatibility question, or the control itself parameter questionWhat should be done to ensure that different phones show the same?============ Solution 1============is not related to
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.