How to realize the change of skin function by using Android
We can make a apk file of the skin package and read the data in the skin package in the application apk.
the condition of applying apk to read the data of skin package apk
1. Have the same signature
2. Androidmanifest.xml configuration Android:shareduserid has the same property value
To meet the above conditions, two apk can access the data each other.
android application steps to replace skin function
1, application and skin procedures in the Androidmanifest.xml configuration
xml/html Code
android:shareduserid= "Com.yee"
2, the application of apk and skin apk in the same function of the skin file name to be consistent
For example: Apply apk to the picture path: \res\drawable-hdpi\xx.png
The image file path in the skin apk should also be: \res\drawable-hdpi\xx.png
3, access to skin resources
Java code:
Context context = Createpackagecontext ("Com.yee.skin", context.context_ignore_security);
Gets the context that corresponds to the skin package Com.yee.skin, and can access any resource in the skin APK package Com.yee.skin by the returned object.
The code to obtain the buttonbackground.png in the skin apk in the application apk is as follows
Java code:
drawable drawable = Context.getresources (). getdrawable (R.drawable.buttonbackground);
The above is the Android application to replace the skin of the implementation method, follow-up to continue to collate relevant information, thank you for the support of this site.