This method gives users a sense of participation and a high degree of freedom. Users can customize the skin of the software according to their own preferences. Some software official website provides tools or methods for skin customization. I suggest that it is better to have a visualization tool with a wizard. use
Users only need to find some pictures and modify the font replacement of the text themselves. Users can upload homemade skins, provide them for other users to download, and earn some virtual money or prizes. This kind is usually played.
The package is inside. Zip format. Extensions can be customized by various companies, and it is most convenient to export them directly if there are production tools. First of all, we must make clear the definition of skin exchange. Software skin includes icons, fonts, layouts, interactive styles, etc. Changing skin means changing some or all of the resources contained in the skin. From the perspective of software implementation, the essential difference between the three skins mentioned above lies in whether the skin is built into the application. For the built-in implementation, it is relatively simple, as long as several sets of skins are designed for users to choose in the process of developing applications. The knowledge used here does not exceed the Android foundation, so I won't explain it in detail. This lesson focuses on how to separate skin from application. skin
Skin generally contains multiple files, such as pictures, configuration files, etc. Scattered files are not conducive to transmission and use, so it is better to pack them. Zip format is generally selected as the packaging format. There are two situations here, one is apk, such as
AdwLauncher, whose desktop skin format is apk;; The other is custom extension, such as the skin extension of ink weather is mja, and the skin extension of sogou input method is sga.
The file format of is actually zip. Explain it separately below. The problem of 1.APK format now becomes how the application reads the resources in another apk. In the android system, apks can read data from each other on the condition that they have the same signature and the attribute values of android:sharedUserId configured in the AndroidManifest.xml file are the same, then two apks run in the same process and can access any data from each other. The method is as follows: 1) Configure the AndroidManifest.xml of the application and the skin program, for example: Android: shared userid = "org.yuchen" 2) The file names of the skin with the same function in apk should be consistent, for example: the background image path of the application: \ skin demo \ RES \ Drawable-hdpi \ BG. png Then the path of the background image file in the skin apk should also be: customskin \ res \ drawable-hdpi \ bg.png3). You can access any resource in org.yuchen.customskin through the returned Context object. For example, bg.png in skin apk is obtained by applying apk, and drawable drawable = context. getresources()。 getdrawable(r . drawable . BG); In this way, references to pictures are obtained, and other xml resource files are obtained in a similar way. 2. The skin technology of zip format with custom extension lies in how to read the resources in zip file and the storage strategy of skin file. square
Case: If the software reads the skin file on the SD card every time it starts, the speed will be slower. A better way is to provide a skin setting interface, which skin the user chooses, and then extract the skin file.
To "/data/data/[package
Name]/skin "path, so you don't need to read it across memory, which is faster, and you don't need to read it in the zip compressed package every time. It doesn't depend on the files in the SD card, even if the skin compressed package file is in.
It doesn't matter if you delete it. Implementation method: 1. Prompt the user to copy the skin file to the specified path of the SD card with the help of software or official website. 2. Provide skin setting interface in the software. It can be in the menu or in the settings. You can refer to ink, sogou input method, QQ and other software that supports skin changing. 3. Load the skin file in the specified path, read the thumbnail, display it in the skin setting interface, and decompress the skin file selected by the user to the "/data/data/[ package name ]/skin" path. 4. Give priority to reading the resources under the path "/data/data/[ package name ]/skin/" in the software. If not, please use the resources in apk.
fresh water