Android skin change

Source: Internet
Author: User

1) configuration in AndroidManifest. xml of applications and skin programs

<Manifest xmlns: android = "http://schemas.android.com/apk/res/android"
Package = ""
Android: versionCode = "6"
Android: versionName = "0.8.8"
Android: sharedUserId = "com. timgor. skin">

2) the file name must be the same as the skin file name of the same function in the application apk.

3) how to access resources

MXXX. getResourcesId (this, "activity_backgroud", "color") public int getResourcesId (Context context, String name, String type) {try {// obtain the skin-shared data packet String packageName = "com. timgor. tttt "; Context skinContext = context. createPackageContext (packageName, Context. CONTEXT_IGNORE_SECURITY); int resID = skinContext. getResources (). getIdentifier (name, type, packageName); if (resID> 0) {return skinContext. getResources (). getColor (resID) ;}} catch (NameNotFoundException e) {e. printStackTrace ();} catch (Exception e) {e. printStackTrace ();} return context. getResources (). getIdentifier (name, type, context. getPackageName ());}

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.